Philip M. Gollucci wrote: > pradeep kumar wrote: > >> Hi Philppe, >> >> I did try using mod_perl 2.0.1 and got the same "-e" in the ps output >> instead of >> "/PATH_TO_HTTPD -d /PATH_OF_APACHE -k start". > > I'll confirm this in mp2 svn.
Still unable to reproduce this on my end.
> Here's the relevenant section in modperl_cmd.c:
>
> {
> SV *code = newSVpv(arg, 0);
> GV *gv = gv_fetchpv("0", TRUE, SVt_PV);
>
> ENTER;SAVETMPS;
This bit creates the equivalent of a {} block for scoping issues
> save_scalar(gv); /* local $0 */
As the comment points out, this is just like local $0
> #if PERL_REVISION == 5 && PERL_VERSION >= 9
> TAINT_NOT; /* XXX: temp workaround, see my p5p post */
> #endif
> sv_setpv_mg(GvSV(gv), directive->filename);
This sets $0 to directive->filename (setpv_mg so that the magic that
changes argv[0] is performed)
> eval_sv(code, G_SCALAR|G_KEEPERR);
> SvREFCNT_dec(code);
> modperl_env_sync_srv_env_hash2table(aTHX_ p, scfg);
> modperl_env_sync_dir_env_hash2table(aTHX_ p, dcfg);
> FREETMPS;LEAVE;
This closes the pseudo-{} block we just created, restoring $0
> }
>
> Okay, now, how do I go about figuring out this XS. I've read most if
> not all of the perldoc things like guts and xs etc...
This is the simplest example I can think of to localize something:
#define PRINT$0 eval_pv("print STDERR qq(Dollar 0 = $0\n)", 0)
GV *gv = gv_fetchpv("0", TRUE, SVt_PV);
PRINT$0;
ENTER;SAVETMPS;
PRINT$0;
save_scalar(gv);
PRINT$0;
sv_setpv_mg(GvSV(gv), "Hello XS");
PRINT$0;
FREETMPS;LEAVE;
PRINT$0;
And you'd get:
Dollar 0 = t/Test.t
Dollar 0 = t/Test.t
Dollar 0 =
Dollar 0 = Hello XS
Dollar 0 = t/Test.t
> Perl_gv_dump and Perl_sv_dump don't tell me too much that I can use.
>
> Any pointers to your favorite documentation?
>
> Me thinks that this needs to change ?
> sv_setpv_mg(GvSV(gv), directive->filename);
Why? It's doing exactly what it's supposed to be doing ...
--------------------------------------------------------------------------------
Philippe M. Chiasson m/gozer\@(apache|cpan|ectoplasm)\.org/ GPG KeyID : 88C3A5A5
http://gozer.ectoplasm.org/ F9BF E0C2 480E 7680 1AE5 3631 CB32 A107 88C3A5A5
signature.asc
Description: OpenPGP digital signature
