A does method sounds like a boolean to me. I'd look for it to return true if and only if the object can do all the listed methods. Also, your error return will not occur if $proto is not a reference.
sub does { my ($proto, @methods) = @_; return if !ref $proto || !blessed $proto; # DeMorgan my @coderefs = map {$proto->can($_) || ()} @methods; return @coderefs == @methods; }
After Compline,
Zaxo
In reply to Re: Class capabilities
by Zaxo
in thread Class capabilities
by Ovid
| For: | Use: | ||
| & | & | ||
| < | < | ||
| > | > | ||
| [ | [ | ||
| ] | ] |