|
|
Choosing A Webhost: |
[PATCH mp2] <Perl> sections setting $0: msg#00152apache.mod-perl.devel
in mp 1.x land, <Perl> sections used to set $0 to the name of the configuration file it was in. Following patches does just that for 2.x Index: Changes =================================================================== RCS file: /home/cvs/modperl-2.0/Changes,v retrieving revision 1.250 diff -u -I$Id: -r1.250 Changes --- Changes 13 Nov 2003 21:03:46 -0000 1.250 +++ Changes 14 Nov 2003 17:40:29 -0000 @@ -12,6 +12,9 @@ =item 1.99_12-dev +<Perl> sections now proprely set $0 to the name of the configuration +file they are in. [Philippe M. Chiasson] + <Perl> sections now proprely set filename and line number information, making error messages report the correct location. [Philippe M. Chiasson] Index: src/modules/perl/modperl_cmd.c =================================================================== RCS file: /home/cvs/modperl-2.0/src/modules/perl/modperl_cmd.c,v retrieving revision 1.50 diff -u -I$Id: -r1.50 modperl_cmd.c --- src/modules/perl/modperl_cmd.c 13 Nov 2003 21:03:46 -0000 1.50 +++ src/modules/perl/modperl_cmd.c 14 Nov 2003 17:40:29 -0000 @@ -409,6 +409,8 @@ arg, NULL); } + sv_setpv(get_sv("0", TRUE), parms->directive->filename); + eval_pv(arg, FALSE); if (SvTRUE(ERRSV)) { Index: t/conf/extra.last.conf.in =================================================================== RCS file: /home/cvs/modperl-2.0/t/conf/extra.last.conf.in,v retrieving revision 1.8 diff -u -I$Id: -r1.8 extra.last.conf.in --- t/conf/extra.last.conf.in 13 Nov 2003 21:03:46 -0000 1.8 +++ t/conf/extra.last.conf.in 14 Nov 2003 17:40:29 -0000 @@ -24,6 +24,7 @@ <Perl > $Apache::Server::SaveConfig = 1; $TestDirective::perl::filename = __FILE__; +$TestDirective::perl::dollar_zero = $0; $TestDirective::perl::line = __LINE__; </Perl> Index: t/response/TestDirective/perldo.pm =================================================================== RCS file: /home/cvs/modperl-2.0/t/response/TestDirective/perldo.pm,v retrieving revision 1.4 diff -u -I$Id: -r1.4 perldo.pm --- t/response/TestDirective/perldo.pm 13 Nov 2003 21:03:47 -0000 1.4 +++ t/response/TestDirective/perldo.pm 14 Nov 2003 17:40:29 -0000 @@ -10,7 +10,7 @@ sub handler { my $r = shift; - plan $r, tests => 7; + plan $r, tests => 8; ok t_cmp('yes', $TestDirective::perl::worked); @@ -21,6 +21,8 @@ ok t_cmp('PerlSection', $Apache::ReadConfig::Location{'/perl_sections_saved'}{'AuthName'}); ok t_cmp('yes', $TestDirective::perl::comments); + + ok t_cmp(qr/extra.last.conf/, $TestDirective::perl::dollar_zero, '$0'); ok t_cmp(qr/extra.last.conf/, $TestDirective::perl::filename, '__FILE__'); -- -------------------------------------------------------------------------------- Philippe M. Chiasson /gozer\@(cpan|ectoplasm)\.org/ 88C3A5A5 (122FF51B/C634E37B) http://gozer.ectoplasm.org/ F9BF E0C2 480E 7680 1AE5 3631 CB32 A107 88C3 A5A5 Q: It is impossible to make anything foolproof because fools are so ingenious. perl -e'$$=\${gozer};{$_=unpack(P7,pack(L,$$));/^JAm_pH\n$/&&print||$$++&&redo}'
|
|
| <Prev in Thread] | Current Thread | [Next in Thread> |
|---|---|---|
| Previous by Date: | Re: mp2 - still cannot start server on solaris, Stas Bekman |
|---|---|
| Next by Date: | Re: [PATCH mp2] <Perl> sections setting $0, Stas Bekman |
| Previous by Thread: | Re: Segmentation fault, Bobber Cheng |
| Next by Thread: | Re: [PATCH mp2] <Perl> sections setting $0, Stas Bekman |
| Indexes: | [Date] [Thread] [Top] [All Lists] |
Free MagazinesCisco NewsReceive a free quarterly e-newsletter with exclusive articles on how Cisco IT uses its own products and solutions to enable the business. subscribe Systems Management News, the newspaper for IT systems administration and data center managers! Each issue of Systems Management News is chock-full of news and analysis to help you understand what's happening in your field. subscribe The Enterprise Newsweekly eWeek is the essential technology information source for builders of e-business. subscribe Oracle Magazine Oracle Magazine contains technology strategy articles, sample code, tips, Oracle and partner news, how to articles for developers and DBAs, and more. Oracle (NASDAQ: ORCL) is the world's largest enterprise software company. subscribe Total Telecom Total Telecom is "The Economist of the communications industry". subscribe |