Fixed additional file installation for multi level app names
[catagits/Catalyst-Runtime.git] / lib / Module / Install / Catalyst.pm
index b4745e0..c3cda12 100644 (file)
@@ -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)
@@ -182,12 +196,15 @@ Usage:
     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 ) {