[Bast-commits] r4302 - trunk/Devel-Declare/t

nothingmuch at dev.catalyst.perl.org nothingmuch at dev.catalyst.perl.org
Sun Apr 27 19:05:10 BST 2008


Author: nothingmuch
Date: 2008-04-27 19:05:09 +0100 (Sun, 27 Apr 2008)
New Revision: 4302

Added:
   trunk/Devel-Declare/t/eval.t
Log:
add eval.t, thought it would fail but it doesn't

Added: trunk/Devel-Declare/t/eval.t
===================================================================
--- trunk/Devel-Declare/t/eval.t	                        (rev 0)
+++ trunk/Devel-Declare/t/eval.t	2008-04-27 18:05:09 UTC (rev 4302)
@@ -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 );
+
+




More information about the Bast-commits mailing list