Author: phred Date: Sun Feb 24 12:20:07 2008 New Revision: 630668 URL: http://svn.apache.org/viewvc?rev=630668&view=rev Log: Fix a bug where _platform_check_size was being called without a class reference when USE_SMAPS=0. Export Apache::SizeLimit::Core package variables to Apache::SizeLimit and Apache2::SizeLimit namespace.
Reviewed-By: phred, geoff Submitted-By: Jeremy Goodridge <[EMAIL PROTECTED]> Modified-By: Fred Moyer <[EMAIL PROTECTED]> Message-ID: 47BD8407.8020802 () modperlcookbook ! org Modified: perl/Apache-SizeLimit/trunk/Changes perl/Apache-SizeLimit/trunk/lib/Apache/SizeLimit.pm perl/Apache-SizeLimit/trunk/lib/Apache/SizeLimit/Core.pm perl/Apache-SizeLimit/trunk/lib/Apache2/SizeLimit.pm perl/Apache-SizeLimit/trunk/t/response/TestApache/basic.pm perl/Apache-SizeLimit/trunk/t/response/TestApache2/basic.pm Modified: perl/Apache-SizeLimit/trunk/Changes URL: http://svn.apache.org/viewvc/perl/Apache-SizeLimit/trunk/Changes?rev=630668&r1=630667&r2=630668&view=diff ============================================================================== --- perl/Apache-SizeLimit/trunk/Changes (original) +++ perl/Apache-SizeLimit/trunk/Changes Sun Feb 24 12:20:07 2008 @@ -8,6 +8,13 @@ =item 0.92-dev +Export USE_SMAPS, VERSION, and REQUEST_COUNT to Apache::SizeLimit +from Apache::SizeLimit::Core. +Call _platform_check_size as a class method to prevent error when +USE_SMAPS=0, RT #33303 +Reported by: [EMAIL PROTECTED] +[Fred Moyer <[EMAIL PROTECTED]>] + *********** HEADS UP - SHARED CODE BASE - HEADS UP *********** Apache-SizeLimit has been hybridized. It has been split into 3 packages. Modified: perl/Apache-SizeLimit/trunk/lib/Apache/SizeLimit.pm URL: http://svn.apache.org/viewvc/perl/Apache-SizeLimit/trunk/lib/Apache/SizeLimit.pm?rev=630668&r1=630667&r2=630668&view=diff ============================================================================== --- perl/Apache-SizeLimit/trunk/lib/Apache/SizeLimit.pm (original) +++ perl/Apache-SizeLimit/trunk/lib/Apache/SizeLimit.pm Sun Feb 24 12:20:07 2008 @@ -32,6 +32,9 @@ $MIN_SHARE_SIZE $CHECK_EVERY_N_REQUESTS $START_TIME + $USE_SMAPS + $VERSION + $REQUEST_COUNT ); use vars qw(@ISA); @ISA = qw(Apache::SizeLimit::Core); Modified: perl/Apache-SizeLimit/trunk/lib/Apache/SizeLimit/Core.pm URL: http://svn.apache.org/viewvc/perl/Apache-SizeLimit/trunk/lib/Apache/SizeLimit/Core.pm?rev=630668&r1=630667&r2=630668&view=diff ============================================================================== --- perl/Apache-SizeLimit/trunk/lib/Apache/SizeLimit/Core.pm (original) +++ perl/Apache-SizeLimit/trunk/lib/Apache/SizeLimit/Core.pm Sun Feb 24 12:20:07 2008 @@ -38,6 +38,9 @@ @ISA = qw(Exporter); @EXPORT_OK = qw( + $VERSION + $REQUEST_COUNT + $USE_SMAPS $MAX_PROCESS_SIZE $MAX_UNSHARED_SIZE $MIN_SHARE_SIZE @@ -111,7 +114,9 @@ } sub _check_size { - my ($size, $share) = _platform_check_size(); + my $class = shift; + + my ($size, $share) = $class->_platform_check_size(); return ($size, $share, $size - $share); } Modified: perl/Apache-SizeLimit/trunk/lib/Apache2/SizeLimit.pm URL: http://svn.apache.org/viewvc/perl/Apache-SizeLimit/trunk/lib/Apache2/SizeLimit.pm?rev=630668&r1=630667&r2=630668&view=diff ============================================================================== --- perl/Apache-SizeLimit/trunk/lib/Apache2/SizeLimit.pm (original) +++ perl/Apache-SizeLimit/trunk/lib/Apache2/SizeLimit.pm Sun Feb 24 12:20:07 2008 @@ -40,6 +40,9 @@ $MIN_SHARE_SIZE $CHECK_EVERY_N_REQUESTS $START_TIME + $USE_SMAPS + $VERSION + $REQUEST_COUNT ); our @ISA = qw(Apache::SizeLimit::Core); Modified: perl/Apache-SizeLimit/trunk/t/response/TestApache/basic.pm URL: http://svn.apache.org/viewvc/perl/Apache-SizeLimit/trunk/t/response/TestApache/basic.pm?rev=630668&r1=630667&r2=630668&view=diff ============================================================================== --- perl/Apache-SizeLimit/trunk/t/response/TestApache/basic.pm (original) +++ perl/Apache-SizeLimit/trunk/t/response/TestApache/basic.pm Sun Feb 24 12:20:07 2008 @@ -15,7 +15,7 @@ sub handler { my $r = shift; - plan $r, tests => 12; + plan $r, tests => 13; ok( ! Apache::SizeLimit->_limits_are_exceeded(), 'check that _limits_are_exceeded() returns false without any limits set' ); @@ -23,6 +23,15 @@ { my ( $size, $shared ) = Apache::SizeLimit->_check_size(); cmp_ok( $size, '>', 0, 'proc size is reported > 0' ); + + { + # test with USE_SMAPS=0 + my $smaps = $Apache::SizeLimit::USE_SMAPS; + $Apache::SizeLimit::USE_SMAPS = 0; + my ( $size, $shared ) = Apache::SizeLimit->_check_size(); + cmp_ok( $size, '>', 0, 'proc size is reported > 0' ); + $Apache::SizeLimit::USE_SMAPS = $smaps; + } SKIP: { Modified: perl/Apache-SizeLimit/trunk/t/response/TestApache2/basic.pm URL: http://svn.apache.org/viewvc/perl/Apache-SizeLimit/trunk/t/response/TestApache2/basic.pm?rev=630668&r1=630667&r2=630668&view=diff ============================================================================== --- perl/Apache-SizeLimit/trunk/t/response/TestApache2/basic.pm (original) +++ perl/Apache-SizeLimit/trunk/t/response/TestApache2/basic.pm Sun Feb 24 12:20:07 2008 @@ -15,7 +15,7 @@ sub handler { my $r = shift; - plan $r, tests => 9; + plan $r, tests => 10; ok( ! Apache2::SizeLimit->_limits_are_exceeded(), 'check that _limits_are_exceeded() returns false without any limits set' ); @@ -23,6 +23,15 @@ { my ( $size, $shared ) = Apache2::SizeLimit->_check_size(); cmp_ok( $size, '>', 0, 'proc size is reported > 0' ); + + { + # test with USE_SMAPS=0 + my $smaps = $Apache2::SizeLimit::USE_SMAPS; + $Apache2::SizeLimit::USE_SMAPS = 0; + my ( $size, $shared ) = Apache2::SizeLimit->_check_size(); + cmp_ok( $size, '>', 0, 'proc size is reported > 0' ); + $Apache2::SizeLimit::USE_SMAPS = $smaps; + } SKIP: {