perl-modperl mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From Geoffrey Young <ge...@modperlcookbook.org>
Subject Re: [mp2] return value of print can break legacy apps
Date Fri, 10 Dec 2004 15:58:18 GMT


Tuomo Salo wrote:
> Under mod_perl2 the return value of print seems to be the number of
> bytes printed. I run across a legacy app (a registry script), that
> frequently used the following idiom:
> 
> 
> print(CGI::redirect("url_to_error_page")) and return if $error;
> 
> 
> While this is obviously a stupid way to write, it seems ok since the
> perldoc for print says: "Prints a string or a list of strings.  Returns
> true if successful."

> Now the redirection will be performed, and an empty string is passed to
> print. print has been overridden by mod_perl2, and will now return the
> number of bytes written, that is, 0. The "and" will naturally
> short-circuit, and the "return" will never be reached.

ok, try this patch.

--Geoff

Mime
View raw message