From: nothingmuch Date: Sun, 27 Apr 2008 18:05:09 +0000 (+0000) Subject: add eval.t, thought it would fail but it doesn't X-Git-Url: http://git.shadowcat.co.uk/gitweb/gitweb.cgi?a=commitdiff_plain;h=373e37b16f470044a0859133d373576f6a3a4245;p=p5sagit%2FDevel-Declare.git add eval.t, thought it would fail but it doesn't git-svn-id: http://dev.catalyst.perl.org/repos/bast/trunk/Devel-Declare@4302 bd8105ee-0ff8-0310-8827-fb3f25b6796d --- 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 ); + +