On the suggestion of mst, which I totally agree with.
[catagits/Catalyst-Devel.git] / lib / Catalyst / Helper.pm
index 3d46c3f..e3176e5 100644 (file)
@@ -58,7 +58,9 @@ sub mk_app {
     $self->{script          } = File::Spec->catdir( $self->{dir}, 'script' );
     $self->{appprefix       } = Catalyst::Utils::appprefix($name);
     $self->{appenv          } = Catalyst::Utils::class2env($name);
-    $self->{startperl       } = "#!$Config{perlpath} -w";
+    $self->{startperl       } = -r '/usr/bin/env' 
+                                ? '#!/usr/bin/env perl' 
+                                : "#!$Config{perlpath} -w";
     $self->{scriptgen       } = $Catalyst::Devel::CATALYST_SCRIPT_GEN || 4;
     $self->{catalyst_version} = $Catalyst::VERSION;
     $self->{author          } = $self->{author} = $ENV{'AUTHOR'}
@@ -596,7 +598,7 @@ Catalyst Contributors, see Catalyst.pm
 
 =head1 LICENSE
 
-This library is free software, you can redistribute it and/or modify
+This library is free software. You can redistribute it and/or modify
 it under the same terms as Perl itself.
 
 =begin pod_to_ignore
@@ -665,7 +667,7 @@ L<[% rootname %]>, L<Catalyst>
 
 =head1 LICENSE
 
-This library is free software, you can redistribute it and/or modify
+This library is free software. You can redistribute it and/or modify
 it under the same terms as Perl itself.
 
 =cut
@@ -727,7 +729,7 @@ sub end : ActionClass('RenderView') {}
 
 =head1 LICENSE
 
-This library is free software, you can redistribute it and/or modify
+This library is free software. You can redistribute it and/or modify
 it under the same terms as Perl itself.
 
 =cut
@@ -826,7 +828,7 @@ Catalyst Contributors, see Catalyst.pm
 =head1 COPYRIGHT
 
 
-This library is free software, you can redistribute it and/or modify
+This library is free software. You can redistribute it and/or modify
 it under the same terms as Perl itself.
 
 =cut
@@ -906,7 +908,7 @@ Catalyst Contributors, see Catalyst.pm
 
 =head1 COPYRIGHT
 
-This library is free software, you can redistribute it and/or modify
+This library is free software. You can redistribute it and/or modify
 it under the same terms as Perl itself.
 
 =cut
@@ -937,6 +939,7 @@ my $restart_delay     = 1;
 my $restart_regex     = '(?:/|^)(?!\.#).+(?:\.yml$|\.yaml$|\.conf|\.pm)$';
 my $restart_directory = undef;
 my $follow_symlinks   = 0;
+my $background        = 0;
 
 my @argv = @ARGV;
 
@@ -952,6 +955,7 @@ GetOptions(
     'restartregex|rr=s'   => \$restart_regex,
     'restartdirectory=s@' => \$restart_directory,
     'followsymlinks'      => \$follow_symlinks,
+    'background'          => \$background,
 );
 
 pod2usage(1) if $help;
@@ -976,6 +980,7 @@ require [% name %];
     restart_regex     => qr/$restart_regex/,
     restart_directory => $restart_directory,
     follow_symlinks   => $follow_symlinks,
+    background        => $background,
 } );
 
 1;
@@ -1007,6 +1012,7 @@ require [% name %];
                       (defaults to '[SCRIPT_DIR]/..')
    -follow_symlinks   follow symlinks in search directories
                       (defaults to false. this is a no-op on Win32)
+   -background        run the process in the background
  See also:
    perldoc Catalyst::Manual
    perldoc Catalyst::Manual::Intro
@@ -1021,7 +1027,7 @@ Catalyst Contributors, see Catalyst.pm
 
 =head1 COPYRIGHT
 
-This library is free software, you can redistribute it and/or modify
+This library is free software. You can redistribute it and/or modify
 it under the same terms as Perl itself.
 
 =cut
@@ -1075,7 +1081,7 @@ Catalyst Contributors, see Catalyst.pm
 
 =head1 COPYRIGHT
 
-This library is free software, you can redistribute it and/or modify
+This library is free software. You can redistribute it and/or modify
 it under the same terms as Perl itself.
 
 =cut
@@ -1086,7 +1092,7 @@ use strict;
 use warnings;
 use Getopt::Long;
 use Pod::Usage;
-eval "use Catalyst::Devel;";
+eval "use Catalyst::Helper;";
 
 if ($@) {
   die <<END;
@@ -1162,7 +1168,7 @@ Catalyst Contributors, see Catalyst.pm
 
 =head1 COPYRIGHT
 
-This library is free software, you can redistribute it and/or modify
+This library is free software. You can redistribute it and/or modify
 it under the same terms as Perl itself.
 
 =cut
@@ -1203,7 +1209,7 @@ sub index :Path :Args(0) {
 
 =head1 LICENSE
 
-This library is free software, you can redistribute it and/or modify
+This library is free software. You can redistribute it and/or modify
 it under the same terms as Perl itself.
 
 =cut