From dcd49c6498af62cbbbd499811920fc9e45f4bdd1 Mon Sep 17 00:00:00 2001
From: Yanick Champoux <yanick@babyl.dyndns.org>
Date: Wed, 5 Nov 2008 19:26:59 -0500
Subject: [PATCH] importing 'croak' from Carp
---
lib/Moose/Policy.pm | 4 +++-
t/bug_40453.t | 33 +++++++++++++++++++++++++++++++++
2 files changed, 36 insertions(+), 1 deletions(-)
create mode 100644 t/bug_40453.t
diff --git a/lib/Moose/Policy.pm b/lib/Moose/Policy.pm
index 87851d6..7a0834b 100644
--- a/lib/Moose/Policy.pm
+++ b/lib/Moose/Policy.pm
@@ -1,5 +1,7 @@
package Moose::Policy;
-use Moose 'confess', 'blessed';
+use Moose qw/ confess blessed /;
+
+use Carp 'croak';
our $VERSION = '0.03';
our $AUTHORITY = 'cpan:STEVAN';
diff --git a/t/bug_40453.t b/t/bug_40453.t
new file mode 100644
index 0000000..a889833
--- /dev/null
+++ b/t/bug_40453.t
@@ -0,0 +1,33 @@
+use strict;
+use warnings;
+
+use Test::More tests => 1; # last test to print
+
+sub meta {
+}
+
+eval q{ use Moose::Policy 'Moose::Policy::FollowPBP' };
+
+like $@ => qr/\Q'main' already has a meta() method, this is very problematic/;
+
+__END__
+
+copy of the bug's report:
+
+
http://rt.cpan.org/Ticket/Display.html?id=40453
+
+Moose::Policy doesn't "use Carp", but does use croak(), which can cause
+problems:
+
+$ cat test.pl
+package Foo;
+sub meta {
+}
+use Moose::Policy 'Moose::Policy::FollowPBP';
+use Moose;
+
+$ perl test.pl
+Undefined subroutine &Moose::Policy::croak called at
+/usr/local/share/perl/5.8.8/Moose/Policy.pm line 20.
+BEGIN failed--compilation aborted at test line 4.
+
--
1.6.0.3