Or when it doesn't contain a class name:
package Test;
sub foo {};
package main;
if (Test->can('foo')) {
print "Hardcoded can works!\n";
}
my $t = 'Test';
if ($t->can('foo')) {
print "Variable can works!\n";
}
Now you or I wouldn't usually let that pass in a code review, which is why I go the extra step of invoking UNIVERSAL::can(). But we both know one dirty little secret of OO Perl, that it's the class name that's important, not the fact that something has been blessed. | [reply] [d/l] |