On the suggestion of mst, which I totally agree with.
Tomas Doran [Sat, 28 Mar 2009 16:51:59 +0000 (16:51 +0000)]
Changes
lib/Catalyst/Helper.pm

diff --git a/Changes b/Changes
index 62ae85f..abd6086 100644 (file)
--- a/Changes
+++ b/Changes
@@ -1,5 +1,8 @@
 This file documents the revision history for Perl extension Catalyst-Devel.
 
+        - Change generated scripts to use /usr/bin/env perl if /usr/bin/env
+          exists, otherwise fall back to the current perl binary. (t0m)
+
 1.10    2009-02-05 15:04
         - fix a bug in created helper scripts that prevened them working (rjbs)
 
index 515ee8e..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'}