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

Matt S Trout dbix-class at trout.me.uk
Sun Mar 19 16:13:58 CET 2006


Bernhard Graf wrote:
> I just wanted to give Catalyst::Plugin::FormValidator::Simple a try, but 
> then I regcognized that it sources Catalyst::Plugin::FormValidator (and 
> of course Data::FormValidator) just to make it play with 
> Catalyst::Plugin::FillInForm. That's ugly!
> 
> Could we please change Catalyst::Plugin::FillInForm in a way that lets 
> it work with both FormValidator plugins? For example instead of saying:
>     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
>     [...]

Wouldn't $c->can('form') be a better check here? A lot of the Catalyst core 
has been moved over to checking for the presence of methods rather than of 
specific subclasses; the pythonistas call the approach "duck typing" and I'm 
rather fond of it.

-- 
      Matt S Trout       Offering custom development, consultancy and support
   Technical Director    contracts for Catalyst, DBIx::Class and BAST. Contact
Shadowcat Systems Ltd.  mst (at) shadowcatsystems.co.uk for more information

+ Help us build a better perl ORM: http://dbix-class.shadowcatsystems.co.uk/ +



More information about the Catalyst mailing list