perl-dev mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From Stas Bekman <s...@stason.org>
Subject [Apache-Test patch] for shebang lines over 64 characters long
Date Thu, 15 Dec 2005 22:29:33 GMT
Apache-Test has a problem on OpenBSD when perl's shebang is too long. This 
patch uses the old eval trick to workaround the problem when we see a perl 
path > 62 chars.

The only reason I didn't commit it right away is because I'm not sure 
whether this workaround works on win32. Can someone on win32 confirm that?

I'd suggest to change the patch to not check the length of 
$Config{perlpath}, just so that you certainly test the right thing.

Thank you.

-------- Original Message --------
Subject: Here's the patch for shebang lines over 64 characters long
Date: Thu, 15 Dec 2005 14:24:22 -0800
From: Mike Smith <mike@mailchannels.com>
To: Stas Bekman <stas@stason.org>

Index: lib/Apache/TestConfig.pm
===================================================================
--- lib/Apache/TestConfig.pm    (revision 356832)
+++ lib/Apache/TestConfig.pm    (working copy)
@@ -1027,7 +1027,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 +1038,18 @@
      chmod 0755, $file;
  }

+sub make_shebang {
+    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 {
      my($self, $from, $to) = @_;
      File::Copy::copy($from, $to);

-- 
Mike Smith                   | MailChannels: Assured Messaging
mailto:mike@mailchannels.com |   http://www.mailchannels.com

-- 
_____________________________________________________________
Stas Bekman mailto:stas@stason.org  http://stason.org/
MailChannels: Assured Messaging(TM) http://mailchannels.com/
The "Practical mod_perl" book       http://modperlbook.org/
http://perl.apache.org/ http://perl.org/ http://logilune.com/


---------------------------------------------------------------------
To unsubscribe, e-mail: dev-unsubscribe@perl.apache.org
For additional commands, e-mail: dev-help@perl.apache.org


Mime
View raw message