Clarify comment.
[catagits/Catalyst-Devel.git] / lib / Catalyst / Helper.pm
index 9b17ffd..4100954 100644 (file)
@@ -5,6 +5,7 @@ use warnings;
 use base 'Class::Accessor::Fast';
 use Config;
 use File::Spec;
+use File::Spec::Unix;
 use File::Path;
 use FindBin;
 use IO::File;
@@ -48,7 +49,7 @@ sub mk_app {
     # Needs to be here for PAR
     require Catalyst;
 
-    if ( $name =~ /[^\w\:]/ ) {
+    if ( $name =~ /[^\w:]/ || $name =~ /^\d/ || $name =~ /\b:\b|:{3,}/) {
         warn "Error: Invalid application name.\n";
         return 0;
     }
@@ -61,7 +62,8 @@ sub mk_app {
     $self->{startperl       } = -r '/usr/bin/env'
                                 ? '#!/usr/bin/env perl'
                                 : "#!$Config{perlpath} -w";
-    $self->{scriptgen       } = $Catalyst::Devel::CATALYST_SCRIPT_GEN || 4;
+    $self->{scriptgen       } = $Catalyst::Devel::CATALYST_SCRIPT_GEN
+        || die("Could not find SCRIPT_GEN");
     $self->{catalyst_version} = $Catalyst::VERSION;
     $self->{author          } = $self->{author} = $ENV{'AUTHOR'}
       || eval { @{ [ getpwuid($<) ] }[6] }
@@ -319,7 +321,7 @@ sub _mk_rootclass {
 
 sub _mk_makefile {
     my $self = shift;
-    $self->{path} = File::Spec->catfile( 'lib', split( '::', $self->{name} ) );
+    $self->{path} = File::Spec::Unix->catfile( 'lib', split( '::', $self->{name} ) );
     $self->{path} .= '.pm';
     my $dir = $self->{dir};
     $self->render_file( 'makefile', "$dir\/Makefile.PL" );
@@ -603,7 +605,7 @@ Create the main application skeleton. This is called by L<catalyst.pl>.
 This method is called by L<create.pl> to make new components
 for your application.
 
-=head3 mk_dir ($path)
+=head2 mk_dir ($path)
 
 Surprisingly, this function makes a directory.
 
@@ -988,7 +990,7 @@ GetOptions(
     'fork|f'              => \$fork,
     'help|?'              => \$help,
     'host=s'              => \$host,
-    'port=s'              => \$port,
+    'port|p=s'            => \$port,
     'keepalive|k'         => \$keepalive,
     'restart|r'           => \$restart,
     'restartdelay|rd=s'   => \$check_interval,
@@ -1031,11 +1033,13 @@ my $runner = sub {
 };
 
 if ( $restart ) {
-    require Catalyst::Restarter;
-
     die "Cannot run in the background and also watch for changed files.\n"
         if $background;
 
+    require Catalyst::Restarter;
+
+    my $subclass = Catalyst::Restarter->pick_subclass;
+
     my %args;
     $args{follow_symlinks} = 1
         if $follow_symlinks;
@@ -1046,9 +1050,10 @@ if ( $restart ) {
     $args{filter} = qr/$file_regex/
         if defined $file_regex;
 
-    my $restarter = Catalyst::Restarter->new(
+    my $restarter = $subclass->new(
         %args,
         start_sub => $runner,
+        argv      => \@argv,
     );
 
     $restarter->run_and_watch;