Your idea forces me to write wrapper objects for every object I want loaded, and you force me to implement the logic in new(). That would prevent me from putting the logic in my object itself. As I already demonstrated, DFV would allow me to put the logic in my object itself.
DFV also allows me to use an arbitrary number of form fields in each constraint, like this:
constraints => { customer_name => { params => [ qw/ customer_name email age / ], constraint => sub { my ($name, $email, $age) = @_; # untaint, trim, whatever return My::Customer->find_or_create( ... ); } } }
In this case, I have inlined the hashref for customer_name, but it is obvious that I can stick that in my My::Customer object:
constraints => { customer_name => My::Customer->complex_constraint, }
As you can see, DFV allows me to create all the logic in-place, or I can push it further down the code; I still have full control over exactly what gets done where, and how. More flexibility, hence more power.
I'm getting a much clearer picture of the usefulness of DFV, thanks to your RFC. In fact, I 'm beginning to see how to implement your Class::CGI as a thin wrapper around DFV :)
In any case, you've made me think about this stuff again, and for that alone I thank you :)
In reply to Re: RFC: Class::CGI
by rhesa
in thread RFC: Class::CGI
by Ovid
| For: | Use: | ||
| & | & | ||
| < | < | ||
| > | > | ||
| [ | [ | ||
| ] | ] |