in reply to When I use "can"

I also use can() to take references to methods. Such as in:
if ($whatever) { $self->{callback} = $self->can('a'); } else { $self->{callback} = sub {1}; }
Or to use optimization if possible:
open F, '>', $self->{filename}; if ($other->can('fetch')) { print F, $other->fetch(); } else { while (my $line = $other->read()) { print F, $line; } } close F;

Search, Ask, Know