I wrote:

> Stop the press! My patch was incomplete:

... and this one was incomplete too, I forgot about the POD. It looks
like I am doomed to make a fool of myself in every conceivable way on
this list :-( Apologies yet again.

Index: ModPerl-Registry/lib/ModPerl/PerlRun.pm
===================================================================
--- ModPerl-Registry/lib/ModPerl/PerlRun.pm     (revision 158046)
+++ ModPerl-Registry/lib/ModPerl/PerlRun.pm     (working copy)
@@ -50,7 +50,7 @@
     cache_table     => 'cache_table_common',
     cache_it        => 'NOP',
     read_script     => 'read_script',
-    rewrite_shebang => 'rewrite_shebang',
+    shebang_to_perl => 'shebang_to_perl',
     get_script_name => 'get_script_name',
     chdir_file      => 'chdir_file_normal',
     get_mark_line   => 'get_mark_line',
Index: ModPerl-Registry/lib/ModPerl/Registry.pm
===================================================================
--- ModPerl-Registry/lib/ModPerl/Registry.pm    (revision 158046)
+++ ModPerl-Registry/lib/ModPerl/Registry.pm    (working copy)
@@ -50,7 +50,7 @@
     cache_table     => 'cache_table_common',
     cache_it        => 'cache_it',
     read_script     => 'read_script',
-    rewrite_shebang => 'rewrite_shebang',
+    shebang_to_perl => 'shebang_to_perl',
     get_script_name => 'get_script_name',
     chdir_file      => 'chdir_file_normal',
     get_mark_line   => 'get_mark_line',
Index: ModPerl-Registry/lib/ModPerl/RegistryCooker.pm
===================================================================
--- ModPerl-Registry/lib/ModPerl/RegistryCooker.pm      (revision 158046)
+++ ModPerl-Registry/lib/ModPerl/RegistryCooker.pm      (working copy)
@@ -371,7 +371,7 @@
     return $rc unless $rc == Apache::OK;
 
     # convert the shebang line opts into perl code
-    $self->rewrite_shebang;
+       my $shebang = $self->shebang_to_perl;
 
     # mod_cgi compat, should compile the code while in its dir, so
     # relative require/open will work.
@@ -397,6 +397,7 @@
                     "sub handler {",
                     "local \$0 = '$script_name';",
                     $nph,
+                    $shebang,
                     $line,
                     ${ $self->{CODE} },
                     "\n}"; # last line comment without newline?
@@ -553,13 +554,13 @@
 }
 
 #########################################################################
-# func: rewrite_shebang
-# dflt: rewrite_shebang
+# func: shebang_to_perl
+# dflt: shebang_to_perl
 # desc: parse the shebang line and convert command line switches
 #       (defined in %switches) into a perl code.
 # args: $self - registry blessed object
-# rtrn: nothing
-# efct: the CODE field gets adjusted
+# rtrn: a Perl snippet to be put at the beginning of the CODE field
+#       by caller
 #########################################################################
 
 my %switches = (
@@ -572,7 +573,7 @@
    'w' => sub { "use warnings;\n" },
 );
 
-sub rewrite_shebang {
+sub shebang_to_perl {
     my $self = shift;
     my($line) = ${ $self->{CODE} } =~ /^(.*)$/m;
     my @cmdline = split /\s+/, $line;
@@ -588,7 +589,8 @@
             $prepend .= $switches{$_}->();
         }
     }
-    ${ $self->{CODE} } =~ s/^/$prepend/ if $prepend;
+
+       return $prepend;
 }
 
 #########################################################################
Index: docs/api/ModPerl/RegistryCooker.pod
===================================================================
--- docs/api/ModPerl/RegistryCooker.pod (revision 158046)
+++ docs/api/ModPerl/RegistryCooker.pod (working copy)
@@ -120,9 +120,9 @@
 
 default: read_script()
 
-=item * rewrite_shebang()
+=item * shebang_to_perl()
 
-default: rewrite_shebang()
+default: shebang_to_perl()
 
 =item * get_script_name()
 


-- 
Dominique QUATRAVAUX                           Ingénieur senior
01 44 42 00 08                                 IDEALX

Attachment: pgpz0X1JxYaD6.pgp
Description: PGP signature

Reply via email to