10 my $code = eval_closure(
11 source => 'sub { die "called\n" }',
13 ok($code, "got something");
15 throws_ok { $code->() } qr/^called$/, "got the right thing";
21 my $code = eval_closure(
22 source => 'sub { push @$bar, @_ }',
28 ok($code, "got something");
32 is_deeply($foo, [1], "got the right thing");
38 my $code = eval_closure(
39 # not sure if strict leaking into evals is intended, i think i remember
40 # it being changed in newer perls
41 source => 'do { no strict; sub { $foo } }',
44 ok($code, "got something");
46 ok(!$code->(), "environment is clean");