1#!perl 2 3BEGIN { 4 require Config; 5 import Config; 6 if ($Config{'extensions'} !~ /\bOpcode\b/) { 7 print "1..0\n"; 8 exit 0; 9 } 10 # Can we load the version module ? 11 eval { require version; 1 } or do { 12 print "1..0 # no version.pm\n"; 13 exit 0; 14 }; 15 delete $INC{"version.pm"}; 16} 17 18use strict; 19use Test::More; 20use Safe; 21plan(tests => 2); 22 23my $c = new Safe; 24$c->permit(qw(require caller entereval unpack)); 25my $r = $c->reval(q{ use version; 1 }); 26ok( defined $r, "Can load version.pm in a Safe compartment" ) or diag $@; 27 28# Does this test really belong here? We are testing the "loading" of 29# a perl version number. 30# This should died because of strictures under 5.12+ and because of the 31# perl version in 5.10-. 32ok !$c->reval(q{use 5.012; $undeclared; 1}), 33 'reval does not prevent use 5.012 from enabling strict'; 34