[Catalyst] Catalyst::Plugin::FormValidator questions

Marcello m.romani at spinsoft.it
Wed Nov 16 08:28:06 CET 2005


John Wang ha scritto:
> Thanks Drew,
> 
> Putting the use declaration in the controller solved the built-in 
> constraint method issue.
> 
> I did some more experimentation with getting a $c context in a custom 
> constraint method with D::FV and C::P::FV. It seems that constraint 
> methods in the profile can't take variables as parameters and also can't 
> take a Catalyst $c->forward as a constraint method. I tried to pass in 
> the Catalyst context object as a parameter but no dice.
> 
> It seems like all the variables available to the custom constraint 
> method come from the $dfv object in the "customized DFV method 
> subroutine" so the Catalyst context object would have to come from there 
> as well but I'm guessing this isn't supported. Something like:
> 
> sub my_custom_constraint {
>   return sub {
>     my $dfv = shift;
>     my $val = $dfv->get_current_constraint_value;
>     my $data = $dfv->get_input_data;
>     ...
>     my $c = $dfv->get_context_obj;
>     ...
>   }
> }
> 
> Is there a way to access the Catalyst $c in a custom constraint method? 

Catalist::Plugin::Singleton ?

> If not, it seems like Catalyst::Plugin::FormValidator::Simple may be the 
> way to go for custom Catalyst-based constraint methods?
> 
> John
> 
> 
> ------------------------------------------------------------------------
> 
> _______________________________________________
> Catalyst mailing list
> Catalyst at lists.rawmode.org
> http://lists.rawmode.org/mailman/listinfo/catalyst


-- 
Marcello Romani
Developer
Spin s.r.l.
Reggio Emilia
http://www.spinsoft.it




More information about the Catalyst mailing list