Re: [BUG] line numbering off-by-one with Apache::DB and RegistryCooker
[prev]
[thread]
[next]
[Date index for 2005/03/18]
--5mCyUwZo2JvN/JJP
Content-Type: text/plain; charset=iso-8859-1
Content-Disposition: inline
Content-Transfer-Encoding: quoted-printable
I wrote:
> Stop the press! My patch was incomplete:
=2E.. 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
=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=
=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=
=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D
--- ModPerl-Registry/lib/ModPerl/PerlRun.pm (revision 158046)
+++ ModPerl-Registry/lib/ModPerl/PerlRun.pm (working copy)
@@ -50,7 +50,7 @@
cache_table =3D> 'cache_table_common',
cache_it =3D> 'NOP',
read_script =3D> 'read_script',
- rewrite_shebang =3D> 'rewrite_shebang',
+ shebang_to_perl =3D> 'shebang_to_perl',
get_script_name =3D> 'get_script_name',
chdir_file =3D> 'chdir_file_normal',
get_mark_line =3D> 'get_mark_line',
Index: ModPerl-Registry/lib/ModPerl/Registry.pm
=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=
=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=
=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D
--- ModPerl-Registry/lib/ModPerl/Registry.pm (revision 158046)
+++ ModPerl-Registry/lib/ModPerl/Registry.pm (working copy)
@@ -50,7 +50,7 @@
cache_table =3D> 'cache_table_common',
cache_it =3D> 'cache_it',
read_script =3D> 'read_script',
- rewrite_shebang =3D> 'rewrite_shebang',
+ shebang_to_perl =3D> 'shebang_to_perl',
get_script_name =3D> 'get_script_name',
chdir_file =3D> 'chdir_file_normal',
get_mark_line =3D> 'get_mark_line',
Index: ModPerl-Registry/lib/ModPerl/RegistryCooker.pm
=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=
=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=
=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D
--- ModPerl-Registry/lib/ModPerl/RegistryCooker.pm (revision 158046)
+++ ModPerl-Registry/lib/ModPerl/RegistryCooker.pm (working copy)
@@ -371,7 +371,7 @@
return $rc unless $rc =3D=3D Apache::OK;
=20
# convert the shebang line opts into perl code
- $self->rewrite_shebang;
+ my $shebang =3D $self->shebang_to_perl;
=20
# 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 =3D '$script_name';",
$nph,
+ $shebang,
$line,
${ $self->{CODE} },
"\n}"; # last line comment without newline?
@@ -553,13 +554,13 @@
}
=20
#########################################################################
-# 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
#########################################################################
=20
my %switches =3D (
@@ -572,7 +573,7 @@
'w' =3D> sub { "use warnings;\n" },
);
=20
-sub rewrite_shebang {
+sub shebang_to_perl {
my $self =3D shift;
my($line) =3D ${ $self->{CODE} } =3D~ /^(.*)$/m;
my @cmdline =3D split /\s+/, $line;
@@ -588,7 +589,8 @@
$prepend .=3D $switches{$_}->();
}
}
- ${ $self->{CODE} } =3D~ s/^/$prepend/ if $prepend;
+
+ return $prepend;
}
=20
#########################################################################
Index: docs/api/ModPerl/RegistryCooker.pod
=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=
=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=
=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D
--- docs/api/ModPerl/RegistryCooker.pod (revision 158046)
+++ docs/api/ModPerl/RegistryCooker.pod (working copy)
@@ -120,9 +120,9 @@
=20
default: read_script()
=20
-=3Ditem * rewrite_shebang()
+=3Ditem * shebang_to_perl()
=20
-default: rewrite_shebang()
+default: shebang_to_perl()
=20
=3Ditem * get_script_name()
=20
--=20
Dominique QUATRAVAUX Ing=E9nieur senior
01 44 42 00 08 IDEALX
--5mCyUwZo2JvN/JJP
Content-Type: application/pgp-signature
Content-Disposition: inline
-----BEGIN PGP SIGNATURE-----
Version: GnuPG v1.2.5 (GNU/Linux)
iD8DBQFCOuoiMJAKAU3mjcsRAihwAJ9iL5hd+4dLx7JNY9Wxb6fF3M/Q3ACfe3MR
VD/qxANLlTrBecLcKFTU2A8=
=cQwQ
-----END PGP SIGNATURE-----
--5mCyUwZo2JvN/JJP--