4 use Test::More 'no_plan';
10 is(mytest(q{foo}),q{foo},"Mytest returns input");
12 my $return = eval { mytest(undef); };
14 ok(!defined($return), "mytest returns undef without autodie");
15 is($@,"","Mytest doesn't throw an exception without autodie");
18 use autodie qw(mytest);
23 is($return,'foo',"Mytest returns input with autodie");
26 use autodie qw(mytest);
31 isa_ok($@,'autodie::exception',"autodie mytest/undef throws exception");
33 # We set initial values here because we're expecting $data to be
34 # changed to undef later on. Having it as undef to begin with means
35 # we can't see mytest(undef) working correctly.
37 my ($data, $data2) = (1,1);
40 use autodie qw(mytest);
43 no autodie qw(mytest);
45 $data = mytest(undef);
46 $data2 = mytest('foo');
50 is($@,"","no autodie can counter use autodie for user subs");
51 ok(!defined($data), "mytest(undef) should return undef");
52 is($data2, "foo", "mytest(foo) should return foo");
58 is($@,"","No lingering failure effects");
64 is($return,"bar","No lingering return effects");