perl-test-commits mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From s...@apache.org
Subject svn commit: r357762 - in /perl/Apache-Test/trunk: Changes lib/Apache/TestConfig.pm
Date Mon, 19 Dec 2005 19:29:59 GMT
Author: stas
Date: Mon Dec 19 11:29:58 2005
New Revision: 357762

URL: http://svn.apache.org/viewcvs?rev=357762&view=rev
Log:
If perlpath is longer than 62 chars, some shells on certain platforms
won't be able to run the shebang line, so when seeing a long perlpath
use the eval workaround
Submitted by: Mike Smith <mike@mailchannels.com>

Modified:
    perl/Apache-Test/trunk/Changes
    perl/Apache-Test/trunk/lib/Apache/TestConfig.pm

Modified: perl/Apache-Test/trunk/Changes
URL: http://svn.apache.org/viewcvs/perl/Apache-Test/trunk/Changes?rev=357762&r1=357761&r2=357762&view=diff
==============================================================================
--- perl/Apache-Test/trunk/Changes (original)
+++ perl/Apache-Test/trunk/Changes Mon Dec 19 11:29:58 2005
@@ -8,6 +8,10 @@
 
 =item 1.28-dev
 
+If perlpath is longer than 62 chars, some shells on certain platforms
+won't be able to run the shebang line, so when seeing a long perlpath
+use the eval workaround [Mike Smith <mike@mailchannels.com>]
+
 Location of the pid file is now configurable via the command line
 -t_pid_file option [Joe Orton]
 

Modified: perl/Apache-Test/trunk/lib/Apache/TestConfig.pm
URL: http://svn.apache.org/viewcvs/perl/Apache-Test/trunk/lib/Apache/TestConfig.pm?rev=357762&r1=357761&r2=357762&view=diff
==============================================================================
--- perl/Apache-Test/trunk/lib/Apache/TestConfig.pm (original)
+++ perl/Apache-Test/trunk/lib/Apache/TestConfig.pm Mon Dec 19 11:29:58 2005
@@ -1028,8 +1028,8 @@
 
     my $fh = $self->genfile($file, undef, 1);
 
-    # shebang
-    print $fh "#!$Config{perlpath}\n";
+    my $shebang = make_shebang();
+    print $fh $shebang;
 
     $self->genfile_warning($file, undef, $fh);
 
@@ -1037,6 +1037,21 @@
 
     close $fh;
     chmod 0755, $file;
+}
+
+sub make_shebang {
+    # if perlpath is longer than 62 chars, some shells on certain
+    # platforms won't be able to run the shebang line, so when seeing
+    # a long perlpath use the eval workaround.
+    my $shebang = length $Config{perlpath} < 62
+        ? "#!$Config{perlpath}\n"
+        : <<EOI;
+#!/usr/bin/perl
+    eval 'exec $Config{perlpath} -S \$0 \${1+"\$@"}'
+        if \$running_under_some_shell;
+EOI
+
+    return $shebang;
 }
 
 sub cpfile {



Mime
View raw message