Re: [mp2] return value of print can break legacy apps

[prev] [thread] [next] [Date index for 2004/12/10]

From: Stas Bekman
Subject: Re: [mp2] return value of print can break legacy apps
Date: 16:04 on 10 Dec 2004
Geoffrey Young wrote:
> 
> 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.

ah, please hold on with patches to change API, if you change this you will 
need to change a lot more (printf, puts, and probably read and may be 
others too).

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

-- 
Report problems: http://perl.apache.org/bugs/
Mail list info: http://perl.apache.org/maillist/modperl.html
List etiquette: http://perl.apache.org/maillist/email-etiquette.html

(message missing)

Re: [mp2] return value of print can break legacy apps
Stas Bekman 16:04 on 10 Dec 2004

Generated at 11:26 on 21 Dec 2004 by mariachi v0.52