Silence warnings in case the expected shim gets garbage collected before any calls
Peter Rabbitson [Sun, 19 Dec 2010 01:25:01 +0000 (01:25 +0000)]
lib/Class/Accessor/Grouped.pm

index aea38c2..74801f8 100644 (file)
@@ -689,7 +689,7 @@ $gen_accessor = sub {
       # if after this shim was created someone wrapped it with an 'around',
       # we can not blindly reinstall the method slot - we will destroy the
       # wrapper. Silently chain execution further...
-      if ($expected_cref != $current_class->can($methname)) {
+      if ( !$expected_cref or $expected_cref != $current_class->can($methname) ) {
 
         # there is no point in re-determining it on every subsequent call,
         # just store for future reference