Please take our Survey
logo       

Choosing A Webhost:
A web hosting service is a type of Internet hosting service that allows individuals and organizations to provide their own website accessible via the World Wide Web. Web hosts are companies that provide space on a server they own for use by their clients as well as providing Internet connectivity, typically in a data center. Web hosts can also provide data center space and connectivity to the Internet for servers they do not own to be located in their data center, called colocation. more...

[PATCH mp2] <Perl> sections setting $0: msg#00152

apache.mod-perl.devel

Subject: [PATCH mp2] <Perl> sections setting $0

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}'

Attachment: signature.asc
Description: This is a digitally signed message part

<Prev in Thread] Current Thread [Next in Thread>
Google Custom Search

Recently Viewed:
solaris.opensol...    editors.vim/200...    web.turbogears....    jakarta.ant.dev...    mathematics.max...    text.unicode.ge...    lang.ruby.core/...    xfce.announce/2...    network.centeri...    php.cvs.pear/20...    user-groups.lin...    kde.devel.quant...    file-systems.ar...    redhat.fedora.t...    apple.fink.auto...    gnome.orbit.gen...    qplus.devel/200...    culture.transpo...    video.dri.user/...    operators.nanog...   
Home | advertise | OSDir is an inevitable website. super tiny logo

Free Magazines

Cisco News
Receive 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

Navigation