Author: randyk Date: Tue Apr 19 20:59:06 2005 New Revision: 162009 URL: http://svn.apache.org/viewcvs?view=rev&rev=162009 Log: Add APR::Status to provide perl glue to the APR_STATUS_IS_* macros of apr_errno.h.
Added: perl/modperl/trunk/t/apr-ext/status.t (with props) perl/modperl/trunk/t/lib/TestAPRlib/status.pm (with props) perl/modperl/trunk/t/response/TestAPR/status.pm (with props) perl/modperl/trunk/xs/APR/Status/ perl/modperl/trunk/xs/APR/Status/APR__Status.h (with props) Modified: perl/modperl/trunk/t/response/TestError/runtime.pm perl/modperl/trunk/xs/maps/apr_functions.map Added: perl/modperl/trunk/t/apr-ext/status.t URL: http://svn.apache.org/viewcvs/perl/modperl/trunk/t/apr-ext/status.t?view=auto&rev=162009 ============================================================================== --- perl/modperl/trunk/t/apr-ext/status.t (added) +++ perl/modperl/trunk/t/apr-ext/status.t Tue Apr 19 20:59:06 2005 @@ -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(); Propchange: perl/modperl/trunk/t/apr-ext/status.t ------------------------------------------------------------------------------ svn:eol-style = native Added: perl/modperl/trunk/t/lib/TestAPRlib/status.pm URL: http://svn.apache.org/viewcvs/perl/modperl/trunk/t/lib/TestAPRlib/status.pm?view=auto&rev=162009 ============================================================================== --- perl/modperl/trunk/t/lib/TestAPRlib/status.pm (added) +++ perl/modperl/trunk/t/lib/TestAPRlib/status.pm Tue Apr 19 20:59:06 2005 @@ -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; Propchange: perl/modperl/trunk/t/lib/TestAPRlib/status.pm ------------------------------------------------------------------------------ svn:eol-style = native Added: perl/modperl/trunk/t/response/TestAPR/status.pm URL: http://svn.apache.org/viewcvs/perl/modperl/trunk/t/response/TestAPR/status.pm?view=auto&rev=162009 ============================================================================== --- perl/modperl/trunk/t/response/TestAPR/status.pm (added) +++ perl/modperl/trunk/t/response/TestAPR/status.pm Tue Apr 19 20:59:06 2005 @@ -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; Propchange: perl/modperl/trunk/t/response/TestAPR/status.pm ------------------------------------------------------------------------------ svn:eol-style = native Modified: perl/modperl/trunk/t/response/TestError/runtime.pm URL: http://svn.apache.org/viewcvs/perl/modperl/trunk/t/response/TestError/runtime.pm?view=diff&r1=162008&r2=162009 ============================================================================== --- perl/modperl/trunk/t/response/TestError/runtime.pm (original) +++ perl/modperl/trunk/t/response/TestError/runtime.pm Tue Apr 19 20:59:06 2005 @@ -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 { Added: perl/modperl/trunk/xs/APR/Status/APR__Status.h URL: http://svn.apache.org/viewcvs/perl/modperl/trunk/xs/APR/Status/APR__Status.h?view=auto&rev=162009 ============================================================================== --- perl/modperl/trunk/xs/APR/Status/APR__Status.h (added) +++ perl/modperl/trunk/xs/APR/Status/APR__Status.h Tue Apr 19 20:59:06 2005 @@ -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 APR_STATUS_IS_EAGAIN Propchange: perl/modperl/trunk/xs/APR/Status/APR__Status.h ------------------------------------------------------------------------------ svn:eol-style = native Modified: perl/modperl/trunk/xs/maps/apr_functions.map URL: http://svn.apache.org/viewcvs/perl/modperl/trunk/xs/maps/apr_functions.map?view=diff&r1=162008&r2=162009 ============================================================================== --- perl/modperl/trunk/xs/maps/apr_functions.map (original) +++ perl/modperl/trunk/xs/maps/apr_functions.map Tue Apr 19 20:59:06 2005 @@ -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