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.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"; }
In reply to Class Name versus Blessed Referent
by chromatic
in thread Calling can method
by gildir
| For: | Use: | ||
| & | & | ||
| < | < | ||
| > | > | ||
| [ | [ | ||
| ] | ] |