Updated Catalyst::PAR to ignore duplicate files
Sebastian Riedel [Thu, 17 Nov 2005 02:21:25 +0000 (02:21 +0000)]
lib/Catalyst/Helper.pm
lib/Catalyst/PAR.pm

index 867d527..f99887b 100644 (file)
@@ -2,7 +2,6 @@ package Catalyst::Helper;
 
 use strict;
 use base 'Class::Accessor::Fast';
-use Config;
 use File::Spec;
 use File::Path;
 use IO::File;
@@ -64,7 +63,7 @@ sub mk_app {
     $self->{dir} =~ s/\:\:/-/g;
     $self->{script}    = File::Spec->catdir( $self->{dir}, 'script' );
     $self->{appprefix} = Catalyst::Utils::appprefix($name);
-    $self->{startperl} = $Config{startperl};
+    $self->{startperl} = '#!/usr/bin/perl -w';
     $self->{scriptgen} = $Catalyst::CATALYST_SCRIPT_GEN || 4;
     $self->{author}    = $self->{author} = $ENV{'AUTHOR'}
       || eval { @{ [ getpwuid($<) ] }[6] }
index d634b07..0f64b85 100644 (file)
@@ -5,6 +5,7 @@ use base 'Class::Accessor::Fast';
 use FindBin;
 use IO::File;
 use File::Spec;
+use File::Find;
 require Catalyst;
 
 =head1 NAME
@@ -43,6 +44,22 @@ sub package {
     eval "use Module::ScanDeps ()";
     die "Please install Module::ScanDeps" if $@;
 
+    chdir File::Spec->catdir( $FindBin::Bin, '..' );
+
+    # Find additional files
+    my @files;
+    finddepth(
+        sub {
+            my $name = $File::Find::name;
+            return if $name =~ /^\W*lib/;
+            return if $name =~ /\.par$/;
+            return if $name !~ /\w+/;
+            warn "$name\n";
+            push @files, $name;
+        },
+        '.'
+    );
+
     my $par_test = File::Spec->catfile( $FindBin::Bin, '..', 'par_test.pl' );
     unlink $par_test;
 
@@ -56,28 +73,17 @@ use $class;
 EOF
     $tmp_file->close;
 
-#    my $main = File::Spec->catfile( $FindBin::Bin, 'main.pl' );
-#    unlink $main;
-
-#    my $version   = $Catalyst::VERSION;
-#    my $main_file = IO::File->new("> $main");
-#    print $main_file <<"EOF";
-#print "$class on Catalyst $version.\\n";
-#EOF
-#    $main_file->close;
-
-    chdir File::Spec->catdir( $FindBin::Bin, '..' );
-    my %opt = ( 'x' => 1, 'n' => 0, 'o' => $par, 'a' => ['.'] );
+    # Create package
+    my %opt = ( 'x' => 1, 'n' => 0, 'o' => $par, 'a' => [@files] );
     App::Packer::PAR->new(
         frontend  => 'Module::ScanDeps',
         backend   => 'PAR::Packer',
         frontopts => \%opt,
         backopts  => \%opt,
-        args => [ 'par_test.pl' ],
+        args      => ['par_test.pl'],
     )->go;
 
     unlink $par_test;
-#    unlink $main;
 }
 
 =back