Commit | Line | Data |
8f73feac |
1 | use strict; |
2 | use warnings; |
3 | use Test::More 'no_plan'; |
4 | |
5 | sub method { |
6 | my ($usepack, $name, $inpack, $sub) = @_; |
7 | no strict 'refs'; |
8 | *{"${inpack}::${name}"} = $sub; |
9 | } |
10 | |
11 | sub handle_method { |
12 | my ($usepack, $use, $inpack, $name) = @_; |
13 | return sub (&) { ($usepack, $name, $inpack, $_[0]); }; |
14 | } |
15 | |
16 | use Devel::Declare 'method' => \&handle_method; |
17 | |
ec2166f5 |
18 | BEGIN { $^H{foo} = 'bar' } |
19 | |
b7505981 |
20 | eval "method bar { 42 }"; |
21 | diag $@ if $@; |
8f73feac |
22 | |
23 | is( __PACKAGE__->bar, 42 ); |
24 | |
25 | |