On Tue, 19 Apr 2005, Randy Kobes wrote: [ ... ] > APR::Status::is_EAGAIN sounds good ... I'll make up a > modified patch doing this, defined as a macro, for just > EAGAIN.
Here it is ... =============================================================== Index: xs/maps/apr_functions.map =================================================================== --- xs/maps/apr_functions.map (revision 162000) +++ xs/maps/apr_functions.map (working copy) @@ -646,3 +646,6 @@ -apr_os_proc_mutex_put -apr_os_shm_get -apr_os_shm_put + +MODULE=APR::Status PREFIX=mpxs_APR__STATUS_ + int:DEFINE_is_EAGAIN | | apr_status_t:rc Index: xs/APR/Status/APR__Status.h =================================================================== --- xs/APR/Status/APR__Status.h (revision 0) +++ xs/APR/Status/APR__Status.h (revision 0) @@ -0,0 +1,18 @@ +/* Copyright 2001-2005 The Apache Software Foundation + * + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + */ + +#include "apr_errno.h" + +#define mpxs_APR__Status_is_EAGAIN(rc) APR_STATUS_IS_EAGAIN(aTHX_ rc) Property changes on: xs/APR/Status/APR__Status.h ___________________________________________________________________ Name: svn:eol-style + native Index: t/apr-ext/status.t =================================================================== --- t/apr-ext/status.t (revision 0) +++ t/apr-ext/status.t (revision 0) @@ -0,0 +1,11 @@ +#!perl -T + +use strict; +use warnings FATAL => 'all'; +use Apache::Test; + +use TestAPRlib::status; + +plan tests => TestAPRlib::status::num_of_tests(); + +TestAPRlib::status::test(); Property changes on: t/apr-ext/status.t ___________________________________________________________________ Name: svn:eol-style + native Index: t/response/TestAPR/status.pm =================================================================== --- t/response/TestAPR/status.pm (revision 0) +++ t/response/TestAPR/status.pm (revision 0) @@ -0,0 +1,27 @@ +package TestAPR::status; + +# Testing APR::Status + +use strict; +use warnings FATAL => 'all'; + +use Apache::Test; + +use Apache2::Const -compile => 'OK'; + +use TestAPRlib::status; + +sub handler { + my $r = shift; + + my $num_of_tests = TestAPRlib::status::num_of_tests(); + plan $r, tests => $num_of_tests; + + TestAPRlib::status::test(); + + Apache2::Const::OK; +} + + + +1; Property changes on: t/response/TestAPR/status.pm ___________________________________________________________________ Name: svn:eol-style + native Index: t/response/TestError/runtime.pm =================================================================== --- t/response/TestError/runtime.pm (revision 162000) +++ t/response/TestError/runtime.pm (working copy) @@ -12,6 +12,7 @@ use Apache2::Const -compile => qw(OK); use APR::Const -compile => qw(EACCES EAGAIN); +use APR::Status (); use constant SIZE => 2048; @@ -43,8 +44,7 @@ unless ref $@ eq 'APR::Error'; # == && != (expecting APR::Const::EAGAIN error) - die "'==' overload is broken" unless $@ == APR::Const::EAGAIN; - die "'==' overload is broken" unless APR::Const::EAGAIN == $@; + die "APR::Status is broken" unless APR::Status::is_EAGAIN($@); die "'==' overload is broken" unless $@ == $@; die "'!=' overload is broken" unless $@ != APR::Const::EACCES; die "'!=' overload is broken" unless APR::Const::EACCES != $@; @@ -102,7 +102,7 @@ # throw in some retry attempts my $tries = 0; RETRY: eval { mp_error($socket) }; - if ($@ && ref($@) && $@ == APR::Const::EAGAIN) { + if ($@ && ref($@) && APR::Status::is_EAGAIN($@)) { if ($tries++ < 3) { goto RETRY; } @@ -118,7 +118,7 @@ sub eval_string_mp_error { my($r, $socket) = @_; eval '$socket->recv(my $buffer, SIZE)'; - if ($@ && ref($@) && $@ == APR::Const::EAGAIN) { + if ($@ && ref($@) && APR::Status::is_EAGAIN($@)) { $r->print("ok eval_string_mp_error"); } else { Index: t/lib/TestAPRlib/status.pm =================================================================== --- t/lib/TestAPRlib/status.pm (revision 0) +++ t/lib/TestAPRlib/status.pm (revision 0) @@ -0,0 +1,23 @@ +package TestAPRlib::status; + +# Testing APR::Status + +use strict; +use warnings FATAL => 'all'; + +use Apache::Test; +use Apache::TestUtil; + +use APR::Const -compile => qw(EAGAIN ENOPOLL); +use APR::Status (); + +sub num_of_tests { + return 2; +} + +sub test { + ok APR::Status::is_EAGAIN(APR::Const::EAGAIN); + ok ! APR::Status::is_EAGAIN(APR::Const::ENOPOLL); +} + +1; Property changes on: t/lib/TestAPRlib/status.pm ___________________________________________________________________ Name: svn:eol-style + native =================================================================== -- best regards, randy --------------------------------------------------------------------- To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED]
