[Catalyst] Catalyst::Plugin::FormValidator questions

John Wang johncwang at gmail.com
Wed Nov 16 03:42:03 CET 2005


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? If
not, it seems like Catalyst::Plugin::FormValidator::Simple may be the way to
go for custom Catalyst-based constraint methods?

John
-------------- next part --------------
An HTML attachment was scrubbed...
URL: http://lists.rawmode.org/pipermail/catalyst/attachments/20051115/9f9b4354/attachment.htm


More information about the Catalyst mailing list