Commit | Line | Data |
---|---|---|
efb592ef | 1 | #!/usr/bin/env perl |
2 | use strict; | |
3 | use warnings; | |
4 | use Test::More; | |
5 | ||
ce19c70b | 6 | use Eval::Closure; |
efb592ef | 7 | |
8 | my $foo = []; | |
9 | ||
10 | my $code = eval_closure( | |
11 | source => 'sub { push @$bar, @_ }', | |
12 | environment => { | |
13 | '$bar' => \$foo, | |
14 | }, | |
15 | name => 'test', | |
16 | ); | |
17 | ok($code, "got something"); | |
18 | ||
19 | $code->(1); | |
20 | ||
21 | is_deeply($foo, [1], "got the right thing"); | |
22 | ||
23 | done_testing; |