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 Tue, 01 Jun 2004 22:27:32 GMT
Stas Bekman wrote:
> While I'm changing most methods to be perlish, I'm very unsure about
> get_brigade and pass_brigade. That interface is poorely documented on 
> Apache side (read: not documented at all) and it's possible that various 
> status codes will be returned and we simply haven't encountered those 
> cases yet. So I'll make an exception here and keep the methods as they 
> are, even though they aren't perlish.
> 
> Unless someone investigates that case before 2.0 is released, they will 
> stay that way.

I feels like I'm talking to myself, but at least my thoughts will get 
documented for the future references.

So I still decided to try and make get_brigade perlish only to discover that 
it's not possible. Since we need to be able to pass $bb from the caller:

that won't work:

sub in_filter {
     my ($filter, $bb, $mode, $block, $readbytes) = @_;

     $bb = $filter->next->get_brigade($mode, $block, $readbytes);

     return Apache::OK;
}

since it overwrites caller's $bb. Of course we could move the buckets, but 
that's not making things any simpler and certainly not more efficient. So the 
API for get_brigade *must* pass $bb as a reference.

In the future we may add an improvement and allow passing 'my $bb' and 
autovivify bucket brigade behind the scenes in cases where a user manually 
does that.

However while changing the tests I've noticed that we have lots of get/pass 
brigade call which don't check the return values and *we* forget to do that, 
then I won't be surprised if many users will forget too. So I'm going to keep 
the arguments as is, but change the return value to return nothing and throw 
exceptions for both methods.

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