Subject: | warning Called UNIVERSAL::can() as a function, not a method |
FreeBSD 6.3-RELEASE-p1, perl v5.8.8.
Class::Std - 0.0.8 and 0.0.9
Got warinings
Called UNIVERSAL::can() as a function, not a method at
/tmp/Class-Std-0.0.9.orig/lib/Class/Std.pm line 564
Attached patch just a workaround for UNIVERSAL/can.pm, subroutine
_report_warning - it's checks caller name.
I'm unable to make simple example to reproduce.
Subject: | can.patch |
diff -urN Class-Std-0.0.9.orig/lib/Class/Std.pm Class-Std-0.0.9.patched/lib/Class/Std.pm
--- Class-Std-0.0.9.orig/lib/Class/Std.pm 2008-03-25 03:08:57.000000000 +0200
+++ Class-Std-0.0.9.patched/lib/Class/Std.pm 2009-01-26 15:09:57.000000000 +0200
@@ -556,8 +556,7 @@
{
my $real_can = \&UNIVERSAL::can;
- no warnings 'redefine', 'once';
- *UNIVERSAL::can = sub {
+ sub can {
my ($invocant, $method_name) = @_;
if ( defined $invocant ) {
@@ -579,6 +578,9 @@
return;
};
+
+ no warnings 'redefine', 'once';
+ *UNIVERSAL::can = \&can;
}
package Class::Std::SCR;