From: Florian Ragwitz <rafl@debian.org>
Date: Mon, 2 May 2011 09:23:52 +0000 (+0200)
Subject: Make sure we keep working with Devel::CallParser loaded
X-Git-Tag: 0.006004~1
X-Git-Url: http://git.shadowcat.co.uk/gitweb/gitweb.cgi?a=commitdiff_plain;h=74d9d9c12fa7015a15d3c8f39d63fa657edd849a;p=p5sagit%2FDevel-Declare.git

Make sure we keep working with Devel::CallParser loaded
---

diff --git a/t/devel_callparser.t b/t/devel_callparser.t
new file mode 100644
index 0000000..e45b6cf
--- /dev/null
+++ b/t/devel_callparser.t
@@ -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;