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

Bernhard Graf catalyst at augensalat.de
Sun Mar 19 17:18:59 CET 2006


On Sunday 19 March 2006 16:20, Nilson Santos Figueiredo Junior wrote:
> On 3/19/06, Bernhard Graf <catalyst at augensalat.de> wrote:
> >     if ( $c->isa('Catalyst::Plugin::FormValidator') ) {
> >         $c->fillform
> >             if $c->form->has_missing
> >     [...]
> > better
> >     if ( my $form = eval { $c->form } ) {
> >         $c->fillform
> >             if $form->has_missing
> >     [...]
>
> eval()ing a method call just to see if it exists (if that's really
> what you meant) is ugly.
> Instead, you should use:
>
> if ($c->can('form')) {
>   # code here
> }

Besides the above code would work perfectly I don't really mind about 
implementation details as using eval or can here.

I just wanted to know if it is OK to slightly change internals of 
C:P:FillInForm and what people (and esp. the authors) think about that.

So at least please adjust your subject line if you want to discuss the 
correct use of UNIVERSAL::isa in this thread. ;-)
-- 
Bernhard Graf



More information about the Catalyst mailing list