[Catalyst] C:P::FormValidator::Simple and C:P:FillInForm

Nilson Santos Figueiredo Junior acid06 at gmail.com
Sun Mar 19 16:37:29 CET 2006


On 3/19/06, Matt S Trout <dbix-class at trout.me.uk> wrote:
> "Some authors call methods in the UNIVERSAL class on potential invocants as
> functions, bypassing any possible overriding. This is wrong and you should not
> do it. Unfortunately, not everyone heeds this warning and their bad code can
> break your good code."

Hmmm... thanks for the enlightment.
I actually thought it was some kind of best practice to call it as a
function. But I guess I'm to blame for not reading UNIVERSAL::can
manpages.

> "Some people argue that you must call UNIVERSAL::can() as a function because
> you don't know if your proposed invocant is a valid invocant. That's silly.

That's exactly the argument that made me switch over from
$obj->can('method') to UNIVERSAL::can($obj, 'method'). I, admittedly,
forgot about things such as isa() and can() overriding (I also use it
when calling isa(), which is probably also wrong ).

I guess now I should switch back to my old coding practices regarding
this subject.

-Nilson Santos F. Jr.



More information about the Catalyst mailing list