X-Git-Url: http://git.shadowcat.co.uk/gitweb/gitweb.cgi?p=catagits%2FCatalyst-Runtime.git;a=blobdiff_plain;f=lib%2FModule%2FInstall%2FCatalyst.pm;h=c3cda12cb11565f22a767a20f3f21160043e0f0f;hp=e4f4264d036846a07671c49bb98f84b4776dacec;hb=5fdd8dc835da6133c754720d8f8c8b2f513cd9bd;hpb=951da69cf3ddde283b6d5a082c1287ce345a51ac diff --git a/lib/Module/Install/Catalyst.pm b/lib/Module/Install/Catalyst.pm index e4f4264..c3cda12 100644 --- a/lib/Module/Install/Catalyst.pm +++ b/lib/Module/Install/Catalyst.pm @@ -1,7 +1,11 @@ package Module::Install::Catalyst; use strict; -use base 'Module::Install::Base'; + +our @ISA; +require Module::Install::Base; +@ISA = qw/Module::Install::Base/; + use File::Find; use FindBin; use File::Copy::Recursive 'rcopy'; @@ -14,6 +18,7 @@ our @CLASSES = (); our $ENGINE = 'CGI'; our $CORE = 0; our $MULTIARCH = 0; +our $SCRIPT; our $USAGE; =head1 NAME @@ -49,7 +54,7 @@ sub catalyst_files { push @files, $name; } closedir CATDIR; - my @path = split '::', $self->name; + my @path = split '-', $self->name; for my $orig (@files) { my $path = File::Spec->catdir( 'blib', 'lib', @path, $orig ); rcopy( $orig, $path ); @@ -87,7 +92,7 @@ sub catalyst_par { Catalyst::Module::Install::_catalyst_par(@_) } sub catalyst_par_core { my ( $self, $core ) = @_; - $core ? ( $CORE = $core ) : $core++; + $core ? ( $CORE = $core ) : $CORE++; } =head2 catalyst_par_classes(@clases) @@ -114,7 +119,16 @@ sub catalyst_par_engine { sub catalyst_par_multiarch { my ( $self, $multiarch ) = @_; - $multiarch ? ( $MULTIARCH = $multiarch ) : $multiarch++; + $multiarch ? ( $MULTIARCH = $multiarch ) : $MULTIARCH++; +} + +=head2 catalyst_par_script($script) + +=cut + +sub catalyst_par_script { + my ( $self, $script ) = @_; + $SCRIPT = $script; } =head2 catalyst_par_usage($usage) @@ -175,16 +189,22 @@ sub _catalyst_par { my $usage = $Module::Install::Catalyst::USAGE || <<"EOF"; Usage: - parl $par [script] [arg1 arg2 arg3...] - $name [script] [arg1 arg2 arg3...] + [parl] $name\[.par] [script] [arguments] + + Examples: + parl $name.par $name\_server.pl -r + myapp $name\_cgi.pl EOF + my $script = $Module::Install::Catalyst::SCRIPT; my $tmp_file = IO::File->new("> $par_pl "); print $tmp_file <<"EOF"; if ( \$ENV{PAR_PROGNAME} ) { my \$zip = \$PAR::LibCache{\$ENV{PAR_PROGNAME}} || Archive::Zip->new(__FILE__); - if (\@ARGV == 0 ) { + my \$script = '$script'; + \$ARGV[0] ||= \$script if \$script; + if ( ( \@ARGV == 0 ) || ( \$ARGV[0] eq '-h' ) || ( \$ARGV[0] eq '-help' )) { my \@members = \$zip->membersMatching('.*script/.*\.pl'); my \$list = " Available scripts:\\n"; for my \$member ( \@members ) { @@ -229,9 +249,9 @@ EOF $tmp_file->close; # Create package - # local $SIG{__WARN__} = sub { }; - # open my $olderr, '>&STDERR'; - # open STDERR, '>', File::Spec->devnull; + local $SIG{__WARN__} = sub { }; + open my $olderr, '>&STDERR'; + open STDERR, '>', File::Spec->devnull; my %opt = ( 'x' => 1, 'n' => 0, @@ -249,9 +269,9 @@ EOF args => ['par.pl'], )->go; - # open STDERR, '>&', $olderr; + open STDERR, '>&', $olderr; - # unlink $par_pl; + unlink $par_pl; chdir $root; rmove( File::Spec->catfile( 'blib', $par ), $par ); return 1;