perl-dev mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From Randy Kobes <ra...@theoryx5.uwinnipeg.ca>
Subject Re: additional APR::Status::is_* functions?
Date Tue, 10 May 2005 04:44:32 GMT
On Sat, 7 May 2005, Stas Bekman wrote:

> Randy Kobes wrote:
[ ... ]
> > However, most of the other APR_STATUS_IS_* macros have this
> > warning in apr_errno.h:
> >   @warning
> >    * always use this test, as platform-specific variances
> >    * may meet this more than one error code
> > as well as comments after the definition of the error
> > code like
> >   @see APR_STATUS_IS_ECONNABORTED
> >    * @warning use APR_STATUS_IS_ECONNABORTED instead of just
> >    * testing this value
> > even for those for which there's no composite, at present.
> > As you say, it is confusing having two ways of accessing
> > these, but perhaps we should follow apr's guide in this
> > respect, and provide APR::Status::is_* for those macros
> > which contain this recommendation for use (for the
> > APR::Const::* provided)?
>
> I have no problem with that, just trying to keep the API
> we expose to the required minimum. The more is exposed the
> more maintenance is required.  That's why I've suggested
> to ask at the apr list. I won't be surprised if that
> warning was just copy-n-paste thing. If it was added 4
> years ago and until today it's still not a composite,
> chances are that it shouldn't be one. but again, it's the
> safest to ask the list.

Here's a response to that question from Joe Orton, in case
it was missed:
==========================================================
On Sun, May 08, 2005 at 05:51:48PM -0500, Randy Kobes wrote:
> mod_perl 2 supplies some APR::* modules for binding to apr,
> and a question has arisen regarding checking error codes
> against the appropriate APR_* constants. In apr_errno.h
> there are warnings about using the corresponding
> APR_STATUS_IS_* macros, as there could be more than one
> variant satisfying an error condition (eg,
> APR_STATUS_IS_ENOENT). There are a number of cases though
> for which at present there's only one such condition (eg,
> APR_STATUS_IS_EOF). What we were wondering is if the
> APR_STATUS_IS_* macros are still strongly recommended to use
> in cases where there is only one variant? Or, for such
> cases, has common useage become just to compare against the
> corresponding APR_* constant (eg, APR_EOF)? Thanks very
> much.

Yes, it's recommended that the APR_STATUS_IS_* macros are
used.  In a small set of cases where the error code is
"invented" by APR like APR_EOF, it doesn't really make any
difference, but I suppose possibly that could change in the
future so better to be safe than sorry...

Regards,

joe
=============================================================

What I'm wondering, in light of the official 2.0 release
soon, is if we were to "convert" to using APR_STATUS_IS_*
for checking all error codes for which there's an existing
APR::Const::*, it might be an idea to do it now, so that
it's in the official 2.0 from the start (I could do that
in the next couple of days, including updating the docs).
If not, that's cool too ...

-- 
best regards,
randy

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


Mime
View raw message