You are viewing a plain text version of this content. The canonical link for it is here.
Posted to dev@perl.apache.org by Stas Bekman <st...@stason.org> on 2004/06/10 10:48:50 UTC
Re: APR::Error constant matching
[adjusting the subject]
Joe Schaefer wrote:
> Stas Bekman <st...@stason.org> writes:
>
> [...]
>
>
>>>>I'm also going to add a wrapper to replace the crafty
>>>>
>>>> if (ref $@ eq 'Apache::Error' && $@ == APR::TIMEUP) { ... }
>>>>
>>>>with:
>>>>
>>>> if (APR::Error::foo($@, APR::TIMEUP)) { ... }
>
>
> OTOH, why not just write
>
> if ($@ == APR::TIMEUP) { ... }
>
> ? If you're worried about numerification warnings
> (assuming $@ isn't a number or an APR::Error object),
> making APR::TIMEUP an APR::Error object would cause
> perl to call the overloaded "==".
That's an idea I haven't thought of. Though it's going to be hard to figure
out which APR::Const and Apache::Const are to be made APR::Error objects,
since on the C level in apr/apache there is no distinction between these
groups. Moreover even we do find a way to create a subset of those, currently
it'll be really hard to tell whether a certain constant is an APR::Error
object and which a real numerical constant. I suppose we will need to
introduce a whole new concept and separate error constants (like APR::TIMEUP)
from other constants (like APR::SO_NONBLOCK). May be those error constants
then should move into a different class? That's a pretty big change.
--
__________________________________________________________________
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