|
|
Choosing A Webhost: |
Re: ModPerl::RegistryCooker messing with status.: msg#00043apache.mod-perl.devel
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> |
|---|---|---|
| Previous by Date: | Re: rfc: new filtering APIs, Stas Bekman |
|---|---|
| Next by Date: | Re: ModPerl::RegistryCooker messing with status., Dmitri Tikhonov |
| Previous by Thread: | ModPerl::RegistryCooker messing with status., Dmitri Tikhonov |
| Next by Thread: | Re: ModPerl::RegistryCooker messing with status., Dmitri Tikhonov |
| 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 |