From: Yuval Kogman Date: Sun, 27 Apr 2008 18:05:09 +0000 (+0000) Subject: add eval.t, thought it would fail but it doesn't X-Git-Tag: 0.005000~114 X-Git-Url: http://git.shadowcat.co.uk/gitweb/gitweb.cgi?a=commitdiff_plain;h=8f73feac5bf38ce5e1b8be9d39465c0b5b00eff7;p=p5sagit%2FDevel-Declare.git add eval.t, thought it would fail but it doesn't --- diff --git a/t/eval.t b/t/eval.t new file mode 100644 index 0000000..2970c93 --- /dev/null +++ b/t/eval.t @@ -0,0 +1,22 @@ +use strict; +use warnings; +use Test::More 'no_plan'; + +sub method { + my ($usepack, $name, $inpack, $sub) = @_; + no strict 'refs'; + *{"${inpack}::${name}"} = $sub; +} + +sub handle_method { + my ($usepack, $use, $inpack, $name) = @_; + return sub (&) { ($usepack, $name, $inpack, $_[0]); }; +} + +use Devel::Declare 'method' => \&handle_method; + +eval "method bar { 42 }"; + +is( __PACKAGE__->bar, 42 ); + +