Make sure we keep working with Devel::CallParser loaded
Florian Ragwitz [Mon, 2 May 2011 09:23:52 +0000 (11:23 +0200)]
t/devel_callparser.t [new file with mode: 0644]

diff --git a/t/devel_callparser.t b/t/devel_callparser.t
new file mode 100644 (file)
index 0000000..e45b6cf
--- /dev/null
@@ -0,0 +1,33 @@
+use warnings;
+use strict;
+
+BEGIN {
+       eval { require Devel::CallParser };
+       if($@ ne "") {
+               require Test::More;
+               Test::More::plan(skip_all => "Devel::CallParser unavailable");
+       }
+}
+
+use Test::More tests => 1;
+
+use Devel::CallParser ();
+
+sub method {
+       my ($usepack, $name, $inpack, $sub) = @_;
+       no strict "refs";
+       *{"${inpack}::${name}"} = $sub;
+}
+
+use Devel::Declare method => sub {
+       my ($usepack, $use, $inpack, $name) = @_;
+       return sub (&) { ($usepack, $name, $inpack, $_[0]); };
+};
+
+method bar {
+       return join(",", @_);
+};
+
+is +__PACKAGE__->bar(qw(x y)), "main,x,y";
+
+1;