Commit | Line | Data |
---|---|---|
a0e934a6 | 1 | #!/usr/bin/env perl |
2 | use strict; | |
3 | use warnings; | |
4 | use Test::More; | |
5 | ||
6 | use Eval::Closure; | |
7 | ||
8 | my $code = eval_closure( | |
9 | source => 'no strict "refs"; sub { keys %{__PACKAGE__ . "::"} }', | |
10 | ); | |
11 | ||
12 | # defining the sub { } creates __ANON__, calling 'no strict' creates BEGIN | |
13 | my @stash_keys = grep { $_ ne '__ANON__' && $_ ne 'BEGIN' } $code->(); | |
14 | ||
15 | is_deeply([@stash_keys], [], "compiled in an empty package"); | |
16 | ||
17 | done_testing; |