Permalink
Browse files

$caller->can is not suitable in this case, it's better checking *{"$c…

…aller\::..."} but I remove this check itself because redefine warning will occur when the function already defined
  • Loading branch information...
1 parent f50cc70 commit 2ccd8ebd20c48287580b3408a40c326cd49632dc @typester committed Oct 29, 2012
Showing with 20 additions and 5 deletions.
  1. +0 −5 lib/Ark/Models.pm
  2. +20 −0 t/models_bug_redefine.t
View
@@ -36,11 +36,6 @@ sub import {
die q[Don't use Ark::Model directly. You must create your own subclasses];
}
- if ($caller->can($flag)) {
- die
- qq[Can't initialize $pkg, method "$flag" is already defined in "$caller"];
- }
-
$pkg->initialize;
}
View
@@ -0,0 +1,20 @@
+use strict;
+use warnings;
+use Test::More;
+
+use FindBin;
+use lib "$FindBin::Bin/models/lib";
+
+
+{
+ package Foo;
+ use T::Models;
+
+ package Bar;
+ use base 'Foo';
+ use T::Models;
+}
+
+pass 'compile ok';
+
+done_testing;

0 comments on commit 2ccd8eb

Please sign in to comment.