Author: randyk
Date: Tue May 10 09:07:55 2005
New Revision: 169487

URL: http://svn.apache.org/viewcvs?rev=169487&view=rev
Log:
Add is_EOF, is_ECONNABORTED, and is_TIMEUP functions to
APR::Status, and use these in the t/protocol/ tests, rather
than checking directly against the appropriate APR::Const::*.

Modified:
    perl/modperl/trunk/t/protocol/TestProtocol/echo_bbs.pm
    perl/modperl/trunk/t/protocol/TestProtocol/echo_bbs2.pm
    perl/modperl/trunk/t/protocol/TestProtocol/echo_filter.pm
    perl/modperl/trunk/t/protocol/TestProtocol/echo_nonblock.pm
    perl/modperl/trunk/t/protocol/TestProtocol/echo_timeout.pm
    perl/modperl/trunk/xs/APR/Status/APR__Status.h
    perl/modperl/trunk/xs/maps/apr_functions.map

Modified: perl/modperl/trunk/t/protocol/TestProtocol/echo_bbs.pm
URL: 
http://svn.apache.org/viewcvs/perl/modperl/trunk/t/protocol/TestProtocol/echo_bbs.pm?rev=169487&r1=169486&r2=169487&view=diff
==============================================================================
--- perl/modperl/trunk/t/protocol/TestProtocol/echo_bbs.pm (original)
+++ perl/modperl/trunk/t/protocol/TestProtocol/echo_bbs.pm Tue May 10 09:07:55 
2005
@@ -19,7 +19,8 @@
 use Apache::TestTrace;
 
 use Apache2::Const -compile => qw(OK MODE_GETLINE);
-use APR::Const    -compile => qw(SUCCESS EOF SO_NONBLOCK);
+use APR::Const    -compile => qw(SUCCESS SO_NONBLOCK);
+use APR::Status ();
 
 sub handler {
     my $c = shift;
@@ -33,7 +34,7 @@
     while (1) {
         debug "asking new line";
         my $rc = $c->input_filters->get_brigade($bb, 
Apache2::Const::MODE_GETLINE);
-        last if $rc == APR::Const::EOF;
+        last if APR::Status::is_EOF($rc);
         die APR::Error::strerror($rc) unless $rc == APR::Const::SUCCESS;
 
         for (my $b = $bb->first; $b; $b = $bb->next($b)) {

Modified: perl/modperl/trunk/t/protocol/TestProtocol/echo_bbs2.pm
URL: 
http://svn.apache.org/viewcvs/perl/modperl/trunk/t/protocol/TestProtocol/echo_bbs2.pm?rev=169487&r1=169486&r2=169487&view=diff
==============================================================================
--- perl/modperl/trunk/t/protocol/TestProtocol/echo_bbs2.pm (original)
+++ perl/modperl/trunk/t/protocol/TestProtocol/echo_bbs2.pm Tue May 10 09:07:55 
2005
@@ -14,7 +14,8 @@
 use APR::Error ();
 
 use Apache2::Const -compile => qw(OK MODE_GETLINE);
-use APR::Const    -compile => qw(SUCCESS EOF SO_NONBLOCK);
+use APR::Const    -compile => qw(SUCCESS SO_NONBLOCK);
+use APR::Status ();
 
 sub handler {
     my $c = shift;
@@ -30,7 +31,7 @@
     while (1) {
         my $rc = $c->input_filters->get_brigade($bb_in,
                                                 Apache2::Const::MODE_GETLINE);
-        last if $rc == APR::Const::EOF;
+        last if APR::Status::is_EOF($rc);
         die APR::Error::strerror($rc) unless $rc == APR::Const::SUCCESS;
 
         next unless $bb_in->flatten(my $data);

Modified: perl/modperl/trunk/t/protocol/TestProtocol/echo_filter.pm
URL: 
http://svn.apache.org/viewcvs/perl/modperl/trunk/t/protocol/TestProtocol/echo_filter.pm?rev=169487&r1=169486&r2=169487&view=diff
==============================================================================
--- perl/modperl/trunk/t/protocol/TestProtocol/echo_filter.pm (original)
+++ perl/modperl/trunk/t/protocol/TestProtocol/echo_filter.pm Tue May 10 
09:07:55 2005
@@ -13,7 +13,8 @@
 
 use base qw(Apache2::Filter);
 
-use APR::Const    -compile => qw(SUCCESS EOF SO_NONBLOCK);
+use APR::Const    -compile => qw(SUCCESS SO_NONBLOCK);
+use APR::Status ();
 use Apache2::Const -compile => qw(OK MODE_GETLINE);
 
 use constant BUFF_LEN => 1024;
@@ -39,7 +40,7 @@
 
     while (1) {
         my $rc = $c->input_filters->get_brigade($bb, 
Apache2::Const::MODE_GETLINE);
-        last if $rc == APR::Const::EOF;
+        last if APR::Status::is_EOF($rc);
         die APR::Error::strerror($rc) unless $rc == APR::Const::SUCCESS;
 
         # fflush is the equivalent of the following 3 lines of code:

Modified: perl/modperl/trunk/t/protocol/TestProtocol/echo_nonblock.pm
URL: 
http://svn.apache.org/viewcvs/perl/modperl/trunk/t/protocol/TestProtocol/echo_nonblock.pm?rev=169487&r1=169486&r2=169487&view=diff
==============================================================================
--- perl/modperl/trunk/t/protocol/TestProtocol/echo_nonblock.pm (original)
+++ perl/modperl/trunk/t/protocol/TestProtocol/echo_nonblock.pm Tue May 10 
09:07:55 2005
@@ -12,8 +12,8 @@
 use Apache::TestTrace;
 
 use Apache2::Const -compile => 'OK';
-use APR::Const    -compile => qw(SO_NONBLOCK TIMEUP SUCCESS POLLIN
-                                 ECONNABORTED);
+use APR::Const    -compile => qw(SO_NONBLOCK SUCCESS POLLIN);
+use APR::Status ();
 
 use constant BUFF_LEN => 1024;
 
@@ -43,7 +43,7 @@
             my $len = eval { $socket->recv($buf, BUFF_LEN) };
             if ($@) {
                 die $@ unless ref $@ eq 'APR::Error'
-                    && $@ == APR::Const::ECONNABORTED; # rethrow
+                    && APR::Status::is_ECONNABORTED($@); # rethrow
                 # ECONNABORTED is not an application error
                 # XXX: we don't really test that we always get this
                 # condition, since it depends on the timing of the
@@ -60,7 +60,7 @@
             debug "sending: $buf";
             $socket->send($buf);
         }
-        elsif ($rc == APR::Const::TIMEUP) {
+        elsif (APR::Status::is_TIMEUP($rc)) {
             debug "timeout";
             $socket->send("TIMEUP\n");
         }

Modified: perl/modperl/trunk/t/protocol/TestProtocol/echo_timeout.pm
URL: 
http://svn.apache.org/viewcvs/perl/modperl/trunk/t/protocol/TestProtocol/echo_timeout.pm?rev=169487&r1=169486&r2=169487&view=diff
==============================================================================
--- perl/modperl/trunk/t/protocol/TestProtocol/echo_timeout.pm (original)
+++ perl/modperl/trunk/t/protocol/TestProtocol/echo_timeout.pm Tue May 10 
09:07:55 2005
@@ -12,7 +12,8 @@
 use APR::Socket ();
 
 use Apache2::Const -compile => 'OK';
-use APR::Const     -compile => qw(TIMEUP SO_NONBLOCK);
+use APR::Const     -compile => qw(SO_NONBLOCK);
+use APR::Status ();
 
 use constant BUFF_LEN => 1024;
 
@@ -32,7 +33,7 @@
         my $buff;
         my $rlen = eval { $socket->recv($buff, BUFF_LEN) };
         if ($@) {
-            die "timed out, giving up: $@" if $@ == APR::Const::TIMEUP;
+            die "timed out, giving up: $@" if APR::Status::is_TIMEUP($@);
             die $@;
         }
 
@@ -40,7 +41,7 @@
 
         my $wlen = eval { $socket->send($buff) };
         if ($@) {
-            die "timed out, giving up: $@" if $@ == APR::Const::TIMEUP;
+            die "timed out, giving up: $@" if APR::Status::is_TIMEUP($@);
             die $@;
         }
     }

Modified: perl/modperl/trunk/xs/APR/Status/APR__Status.h
URL: 
http://svn.apache.org/viewcvs/perl/modperl/trunk/xs/APR/Status/APR__Status.h?rev=169487&r1=169486&r2=169487&view=diff
==============================================================================
--- perl/modperl/trunk/xs/APR/Status/APR__Status.h (original)
+++ perl/modperl/trunk/xs/APR/Status/APR__Status.h Tue May 10 09:07:55 2005
@@ -18,3 +18,6 @@
 #define mpxs_APR__Status_is_EAGAIN APR_STATUS_IS_EAGAIN
 #define mpxs_APR__Status_is_EACCES APR_STATUS_IS_EACCES
 #define mpxs_APR__Status_is_ENOENT APR_STATUS_IS_ENOENT
+#define mpxs_APR__Status_is_EOF APR_STATUS_IS_EOF
+#define mpxs_APR__Status_is_ECONNABORTED APR_STATUS_IS_ECONNABORTED
+#define mpxs_APR__Status_is_TIMEUP APR_STATUS_IS_TIMEUP

Modified: perl/modperl/trunk/xs/maps/apr_functions.map
URL: 
http://svn.apache.org/viewcvs/perl/modperl/trunk/xs/maps/apr_functions.map?rev=169487&r1=169486&r2=169487&view=diff
==============================================================================
--- perl/modperl/trunk/xs/maps/apr_functions.map (original)
+++ perl/modperl/trunk/xs/maps/apr_functions.map Tue May 10 09:07:55 2005
@@ -648,6 +648,9 @@
 -apr_os_shm_put
 
 MODULE=APR::Status      PREFIX=mpxs_APR__STATUS_
- int:DEFINE_is_EAGAIN | | apr_status_t:rc
- int:DEFINE_is_EACCES | | apr_status_t:rc
- int:DEFINE_is_ENOENT | | apr_status_t:rc
+ int:DEFINE_is_EAGAIN       | | apr_status_t:rc
+ int:DEFINE_is_EACCES       | | apr_status_t:rc
+ int:DEFINE_is_ENOENT       | | apr_status_t:rc
+ int:DEFINE_is_EOF          | | apr_status_t:rc
+ int:DEFINE_is_ECONNABORTED | | apr_status_t:rc
+ int:DEFINE_is_TIMEUP       | | apr_status_t:rc


Reply via email to