Source

perl-begin / gen-helpers.pl

shl...@13c2ddb8-… b4cdae9 





shl...@13c2ddb8-… 6842c8c 
shl...@13c2ddb8-… b4cdae9 



















shl...@13c2ddb8-… 6842c8c 
















































shl...@13c2ddb8-… b4cdae9 
#!/usr/bin/perl

use strict;
use warnings;

use HTML::Latemp::GenMakeHelpers;
use File::Find::Object::Rule;

my $generator = 
    HTML::Latemp::GenMakeHelpers->new(
        'hosts' =>
        [
            {
                'id' => "common",
                'source_dir' => "common",
                'dest_dir' => "\$(TARGET)",
            },
            {
                'id' => "berlios",
                'source_dir' => "src",
                'dest_dir' => "\$(TARGET)",
            },
        ],
    );
    
$generator->process_all();

{
    open my $out_fh, ">", "p4n.mak";

    my @targets;
    foreach my $part_idx (1 .. 4)
    {
         # find all the .pm files in @INC
         my @files = 
            File::Find::Object::Rule
                ->any(
                    (File::Find::Object::Rule
                        ->name(qr/\.svn/)
                        ->prune()
                        ->discard()
                    ),
                    (File::Find::Object::Rule
                        ->file()
                        ->exec(sub { 
                                $_[0] ne "index\.html" 
                        })
                    ),
                )->in("lib/tutorials/perl-for-newbies/lect${part_idx}-all-in-one/")
                ;
        
        foreach my $f (@files)
        {
            my $target = $f;

            # print $f, "\n";
            $target =~ s{\Alib/}{};
           
            $target =~ s{/lect(\d+)-all-in-one/}{/part$1/};
            
            $target = "\$(BERLIOS_DEST)/$target";

            push @targets, $target;

            print {$out_fh} "$target: $f\n\tmkdir -p `dirname \$\@`\n\tcp -f \$< \$\@\n\n";
        }
    }

    my $makefile_var_name = "DEST_TUTORIALS_PERL_FOR_NEWBIES_TARGETS";

    print {$out_fh} "$makefile_var_name = " . join(" ", @targets) . "\n\n";

    print {$out_fh} "perl_for_newbies_extra_data: \$($makefile_var_name)\n\n";

    close($out_fh);
}
1;
Tip: Filter by directory path e.g. /media app.js to search for public/media/app.js.
Tip: Use camelCasing e.g. ProjME to search for ProjectModifiedEvent.java.
Tip: Filter by extension type e.g. /repo .js to search for all .js files in the /repo directory.
Tip: Separate your search with spaces e.g. /ssh pom.xml to search for src/ssh/pom.xml.
Tip: Use ↑ and ↓ arrow keys to navigate and return to view the file.
Tip: You can also navigate files with Ctrl+j (next) and Ctrl+k (previous) and view the file with Ctrl+o.
Tip: You can also navigate files with Alt+j (next) and Alt+k (previous) and view the file with Alt+o.