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...

Re: ModPerl::RegistryCooker messing with status.: msg#00043

apache.mod-perl.devel

Subject: Re: ModPerl::RegistryCooker messing with status.

Dmitri Tikhonov wrote:
I upgraded to 1.99.08 a couple of days ago and noticed strange behavior in my CGI scripts that run under ModPerl::Registry -- in 1.99.07 they worked fine. In 1.99.08, however, every single one of my scripts has this appended to its standard output:

As you've figured out my original bug fix was wrong, since it broke other cases. We need more tests to avoid this kind of bugs in the future. it seems that Apache::Registry and Apache::PerlRun handle the return codes differently. So without covering all possible cases I'm not sure what's the best approach. Can you please try the following patch and let me know if it works for you? Thanks.

(it's really only the first chunk that tries to fix the bug, the rest are just some fixes to sync with 1.0.)

Index: lib/ModPerl/RegistryCooker.pm
===================================================================
RCS file: /home/cvs/modperl-2.0/ModPerl-Registry/lib/ModPerl/RegistryCooker.pm,v
retrieving revision 1.27
diff -u -r1.27 RegistryCooker.pm
--- lib/ModPerl/RegistryCooker.pm 6 Jan 2003 10:42:38 -0000 1.27
+++ lib/ModPerl/RegistryCooker.pm 17 Jan 2003 06:15:14 -0000
@@ -163,9 +163,13 @@
# handlers shouldn't set $r->status but return it
my $old_status = $self->[REQ]->status;
my $rc = $self->run;
- $self->[REQ]->status($old_status);
+ my $new_status = $self->[REQ]->status;

- return ($rc != Apache::OK) ? $rc : $self->[STATUS];
+ # only if the script has changed the status, reset to the old
+ # status and return the new status
+ return $old_status != $new_status
+ ? $self->[REQ]->status($old_status)
+ : $rc;
}

#########################################################################
@@ -185,11 +189,11 @@
$self->set_script_name;
$self->chdir_file;

- my $rc = Apache::OK;
my $cv = \&{"$package\::handler"};

my %orig_inc = %INC;

+ my $rc;
{ # run the code and preserve warnings setup when it's done
no warnings;
eval { $rc = $cv->($r, @_) };
@@ -208,11 +212,11 @@

#XXX: $self->chdir_file("$Apache::Server::CWD/");

- if ( ($rc = $self->error_check) != Apache::OK) {
- return $rc;
+ if ( (my $err_rc = $self->error_check) != Apache::OK) {
+ return $err_rc;
}

- return Apache::OK;
+ return wantarray ? (Apache::OK, $rc) : Apache::OK;
}

__________________________________________________________________
Stas Bekman JAm_pH ------> Just Another mod_perl Hacker
http://stason.org/ mod_perl Guide ---> http://perl.apache.org
mailto:stas@xxxxxxxxxx http://use.perl.org http://apacheweek.com
http://modperlbook.org http://apache.org http://ticketmaster.com


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

Recently Viewed:
qplus.devel/200...    network.jabber....    debian.qa-packa...    encryption.gpg....    python.dabo.dev...    uclinux.devel/2...    science.mathema...    recreation.pesc...    kernel.ck/2004-...    mozilla.devel.e...    tex.latex.prosp...    ietf.multi6/200...    bbc.cvs/2002-11...    xfree86.newbie/...    jakarta.taglibs...    altlinux.hardwa...    comedi/2002-05/...    horde.bugs/2004...    games.diplomacy...    finance.e-gold....    web.dom.test-su...    lang.ruby.rails...    os.netbsd.devel...    video.gstreamer...   
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