add eval.t, thought it would fail but it doesn't
nothingmuch [Sun, 27 Apr 2008 18:05:09 +0000 (18:05 +0000)]
git-svn-id: http://dev.catalyst.perl.org/repos/bast/trunk/Devel-Declare@4302 bd8105ee-0ff8-0310-8827-fb3f25b6796d

t/eval.t [new file with mode: 0644]

diff --git a/t/eval.t b/t/eval.t
new file mode 100644 (file)
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 );
+
+