fix 11773 Pluggable allows arbitrary module load

This commit is contained in:
Doug Bell 2010-08-10 21:17:20 -05:00
parent c3989308fa
commit bb2e32141d
3 changed files with 15 additions and 1 deletions

View file

@ -41,7 +41,7 @@ use WebGUI::Pluggable;
#----------------------------------------------------------------------------
# Tests
plan tests => 12; # Increment this number for each test you create
plan tests => 18; # Increment this number for each test you create
#----------------------------------------------------------------------------
# put your tests here
@ -62,6 +62,14 @@ is($dumper->Dump, q|$VAR1 = {
};
|, "Can instanciate an object.");
ok( !eval{ WebGUI::Pluggable::load( '::HA::HA' ); 1 }, 'load dies on bad input' );
like( $@, qr/^\QInvalid module name: ::HA::HA/, 'helpful error message' );
ok( !eval{ WebGUI::Pluggable::load( 'HA::HA::' ); 1 }, 'load dies on bad input' );
ok( !eval{ WebGUI::Pluggable::load( 'HA::..::..::HA' ); 1 }, 'load dies on bad input' );
ok( !eval{ WebGUI::Pluggable::load( '..::..::..::HA' ); 1 }, 'load dies on bad input' );
ok( !eval{ WebGUI::Pluggable::load( 'uploads::ik::jo::ikjosdfwefsdfsefwef::myfile.txt\0.pm' ); 1 }, 'load dies on bad input' );
#----------------------------------------------------------------------------
# Test find and findAndLoad
{ # Block to localize @INC