Stuff with the Perl Foundation. A couple of patches in the Perl core. A few CPAN modules. That about sums it up.
I've been toying with the idea of creating something like this:
use CGI::Simple::AsObjects
handle => [qw/Customers Products/];
my $cgi = CGI::Simple::AsObjects->new;
my $customer = $cgi->cust_param('customer_no');
print $customer->name; # objects directly from the CGI request
Still, if you know OO Perl, do you still use CGI, or would anyone even want this? I think it's a useful idea, but I'd have to play with the interface. The import list is almost like traits in that you can have a variety of specialized "param" methods automatically available and you can fetch an object directly back from an CGI parameter without the tedious hassle of validating the object ids and instantiating the objects.
Can it be easy? (Score:2)
Re:Can it be easy? (Score:1)
Re:Can it be easy? (Score:2)
If you are just writing a small script or two, this would be overkill. However, if you're building a large system, I think the setup would be worth it. Going with Juerd's name of "Class::CGI", I am thinking something along the following lines, with three required subs:
Re:Can it be easy? (Score:1)
However when you finish your module and flesh it out, you'll probably discover that you've started writing a controller in an MVC pattern.
Re:Can it be easy? (Score:2)
I was certainly considering the issue of handling conflicts. That could get annoying, particularly if a given controller does not use the conflicting packages but some poor sod gets bitten by it later down the road.
Class::CGI (Score:2)
Re:Class::CGI (Score:2)
Much better name. Thank you. See my response to brian d foy for more implementation ideas.
I do a similar thing (Score:2)
It has a few neat features including supporting a prefix so if you have two addresses in the same field you can use:
and:
Re:I do a similar thing (Score:1)
I have something similar to you except I combine the validation at a higher level when deciding if a form should be processed or simply displayed. So I can't do the individual object level validation like you're doing. Any errors from D::FV are eventually stuffed into the template param
"Perl users are the Greatful Dead fans of computer science." --slashdot comment
Re:I do a similar thing (Score:2)
Re:I do a similar thing (Score:1)
"Perl users are the Greatful Dead fans of computer science." --slashdot comment