You are viewing a plain text version of this content. The canonical link for it is here.
Posted to modperl-cvs@perl.apache.org by pg...@apache.org on 2006/08/23 07:38:08 UTC

svn commit: r433911 - /perl/Apache-SizeLimit/trunk/lib/Apache/SizeLimit2.pm

Author: pgollucci
Date: Tue Aug 22 22:38:06 2006
New Revision: 433911

URL: http://svn.apache.org/viewvc?rev=433911&view=rev
Log:
MP2ize

Modified:
    perl/Apache-SizeLimit/trunk/lib/Apache/SizeLimit2.pm

Modified: perl/Apache-SizeLimit/trunk/lib/Apache/SizeLimit2.pm
URL: http://svn.apache.org/viewvc/perl/Apache-SizeLimit/trunk/lib/Apache/SizeLimit2.pm?rev=433911&r1=433910&r2=433911&view=diff
==============================================================================
--- perl/Apache-SizeLimit/trunk/lib/Apache/SizeLimit2.pm (original)
+++ perl/Apache-SizeLimit/trunk/lib/Apache/SizeLimit2.pm Tue Aug 22 22:38:06 2006
@@ -17,32 +17,34 @@
 
 use strict;
 
-use Apache::Constants qw(DECLINED OK);
+use Apache2::RequestUtil ();
+use Apache2::Const -compile => qw (DECLINED OK);
 
-use vars qw($VERSION)
+use ModPerl::Util ();
 
-$VERSION = '0.91-dev';
+# 2.x requires 5.6.x+ so 'our' is okay
+our $VERSION = '0.91-dev';
 
 sub handler ($$) {
     my $class = shift;
-    my $r = shift || Apache->request;
+    my $r = shift || Apache2::RequestUtil->request();
 
-    return DECLINED unless $r->is_main();
+    return Apache2::Const::DECLINED unless $r->is_initial_req();
 
     # we want to operate in a cleanup handler
-    if ( $r->current_callback eq 'PerlCleanupHandler' ) {
+    if (ModPerl::Util::current_callback() eq 'PerlCleanupHandler') {
         return $class->_exit_if_too_big($r);
     }
     else {
         $class->add_cleanup_handler($r);
     }
 
-    return DECLINED;
+    return Apache2::Const::DECLINED;
 }
 
 sub add_cleanup_handler {
     my $class = shift;
-    my $r = shift || Apache->request;
+    my $r = shift || Apache2::RequestUtil->request();
 
     return unless $r;
     return if $r->pnotes('size_limit_cleanup');
@@ -51,9 +53,12 @@
     # test it, since apparently it does not push a handler onto the
     # PerlCleanupHandler phase. That means that there's no way to use
     # $r->get_handlers() to check the results of calling this method.
-    $r->push_handlers( 'PerlCleanupHandler',
-                       sub { $class->_exit_if_too_big(shift) } );
-    $r->pnotes( size_limit_cleanup => 1 );
+    $r->push_handlers(
+                      'PerlCleanupHandler',
+                      sub { $class->_exit_if_too_big(shift) }
+                     );
+
+    $r->pnotes(size_limit_cleanup => 1);
 }
 
 1;