perl-dev mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From Stas Bekman <s...@stason.org>
Subject Re: [mp2] get_brigade/pass_brigade will continue to return apr_status_t
Date Wed, 02 Jun 2004 18:02:44 GMT
Geoffrey Young wrote:
> 
> Stas Bekman wrote:
> 
> 
>>I feels like I'm talking to myself
> 
> 
> well, I'm listening at least :)  I have just been incredibly busy with other
> things lately.  sorry about that.

No problem, just trying not to drag those things and get the API finished 
asap. I'm double pressed as I have to submit my OSCon tutorial papers in 12 
days and I won't want my tutorial attendees get outdated printouts when I 
present it one month later.

>>Since we don't return anything, but rc, from the get_brigade,
>>pass_brigade and fflush, I think the golden solution is to always return
>>rc, but to croak if there is an error and a user didn't bother to check
>>rc (i.e. calling in the void context).
> 
> 
> that sounds like a really nice idiom for us to follow - if the user
> specifically captures $rc then assume they want to handle it, but croak if
> they don't even check the return code.
> 
> perl++ for letting us know stuff like that in the first place :)

Yeah, I like that too. The only problem is when a user captures $rc, but 
doesn't do anything with it. ;) I found quite a few places in our tests that 
did just that. Now fixed.

But this is not only for lazy users, this is good for everybody. Most of the 
time you really don't need to check for errors, if you know that any will be 
handled for you. The only time when you need to do that if you want to trap 
them and may be do something else instead of failing, or if there is an $rc 
which is not APR::SUCCESS, but still not a failure. e.g. in the case of 
protocol handlers you get APR::EOF at the end of the connection and it's not a 
failure code. So here you want to handle the errors by yourself.

The current tests do both - explicit and implicit error checking.

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

---------------------------------------------------------------------
To unsubscribe, e-mail: dev-unsubscribe@perl.apache.org
For additional commands, e-mail: dev-help@perl.apache.org


Mime
View raw message