Subject: | Don't recommend eval-wrapping |
OK, starting to get a bit more pedantic now :)
I went through the same process with Class::Autouse, so now I get to
inflict the pain on to you some more.
You shouldn't recommend eval-wrapping of ->can calls.
Because ->can can be implemented by modules in custom code, that custom
code (unlike the actualy UNIVERSAL::can function) can throw die/exceptions).
Those errors need to ACTUALLY die.
By eval-wrapping a ->can call, people are going to effectively ignore
the errors thrown by ->can methods, and thus trigger a falsely-correct
false result from the ->can call.
This could easily result in either totally incorrect errors being
called, or incorrect behaviour. Any there's nothing you can really add
to UNIVERSAL::can (the module) to prevent it (I think...) because it
never makes it to your code (it hits the custom ->can method before
yours)...
So you can't recommend eval-wrapping.
You have to a) ONLY recommend (Params::Util::blessed($_[0]) and
$_[0]->can('foo')) type tests or b) Wait for me to add an importable
_CAN function to Params::Util.