1#!./perl 2 3BEGIN { 4 chdir 't' if -d 't'; 5 require './test.pl'; 6} 7 8plan tests => 4; 9 10BEGIN { 11 unshift @INC, sub { 12 return () unless $_[1] =~ m#\At/(Foo|Bar)\.pm\z#; 13 my $t = 0; 14 return sub { 15 if(!$t) { 16 $_ = "int(1,2);\n"; 17 $t = 1; 18 $@ = "wibble"; 19 return 1; 20 } else { 21 return 0; 22 } 23 }; 24 }; 25} 26 27is +(do "t/Bar.pm"), undef; 28like $@, qr/\AToo many arguments for int /; 29is eval { require "t/Foo.pm" }, undef; 30like $@, qr/\AToo many arguments for int /; 31 321; 33