[Catalyst] Catalyst::Plugin::FormValidator questions

Phil Mitchell phil at 2people.org
Fri Nov 18 17:53:03 CET 2005


>
> There's nothing magic about this syntax. 'email()' is not somehow being
> passed into DFV 'as a sub' or anything like that. 'email()' is a
> subroutine call, it is executed at this point in your Perl code, and
> whatever it returns is passed into DFV. So to design a DFV constraint,
> you should write a subroutine which returns a subref. (Exactly as you
> suggested).
>
> The subroutine can take whatever parameters you want it to take. You're
> the one that's calling it. The 'email()' example above is taking no
> parameters. My custom_constraint took one parameter, the context object
> which is then 'lexically captured' in the subref (more precisely, in the
> *closure*) that the subroutine returns.

Jules, thanks for this explanation. I, too, was thinking a bit
magically about D:FV and am really glad to realize that it's got this
flexibility.

>
> If you still can't get it to work I'll try to knock up a minimal working
> example.
>
> Jules
>
>
> _______________________________________________
> Catalyst mailing list
> Catalyst at lists.rawmode.org
> http://lists.rawmode.org/mailman/listinfo/catalyst
>


--
==========================
2People Blog: http://2-people.blogspot.com/
2People site: http://www.2people.org



More information about the Catalyst mailing list