[Catalyst] C:P::FormValidator::Simple and C:P:FillInForm
    Nilson Santos Figueiredo Junior 
    acid06 at gmail.com
       
    Sun Mar 19 16:20:03 CET 2006
    
    
  
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
}
If you're not sure whether $c is an object or not, you should use:
if (UNIVERSAL::can($c, 'form')) {
  # code here
}
If I've missed your point, please, disregard this message.
-Nilson Santos F. Jr.
    
    
More information about the Catalyst
mailing list