add eval.t, thought it would fail but it doesn't
Yuval Kogman [Sun, 27 Apr 2008 18:05:09 +0000 (18:05 +0000)]
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 );
+
+