POD tweak (Oleg Kostyuk)
[catagits/Catalyst-Devel.git] / lib / Catalyst / Helper.pm
index 3f5a176..d7b5d70 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;
     }
@@ -319,7 +320,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 +604,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.
 
@@ -770,6 +771,7 @@ it under the same terms as Perl itself.
 
 1;
 __makefile__
+[% startperl %]
 # IMPORTANT: if you delete this file your app will not work as
 # expected.  You have been warned.
 use inc::Module::Install;
@@ -790,8 +792,8 @@ install_script glob('script/*.pl');
 auto_install;
 WriteAll;
 __config__
-# rename this file to [% name %].yml and put a : in front of "name" if
-# you want to use yaml like in old versions of Catalyst
+# rename this file to [% name %].yml and put a ':' in front of 'name' if
+# you want to use YAML like in old versions of Catalyst
 name [% name %]
 __readme__
 Run script/[% appprefix %]_server.pl to test the application.
@@ -801,6 +803,7 @@ This file documents the revision history for Perl extension [% name %].
 0.01  [% time %]
         - initial revision, generated by Catalyst
 __apptest__
+[% startperl %]
 use strict;
 use warnings;
 use Test::More tests => 2;
@@ -809,6 +812,7 @@ BEGIN { use_ok 'Catalyst::Test', '[% name %]' }
 
 ok( request('/')->is_success, 'Request should succeed' );
 __podtest__
+[% startperl %]
 use strict;
 use warnings;
 use Test::More;
@@ -819,6 +823,7 @@ plan skip_all => 'set TEST_POD to enable this test' unless $ENV{TEST_POD};
 
 all_pod_files_ok();
 __podcoveragetest__
+[% startperl %]
 use strict;
 use warnings;
 use Test::More;
@@ -984,7 +989,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,
@@ -1027,11 +1032,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;
@@ -1042,9 +1049,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;