Stories
Slash Boxes
Comments
NOTE: use Perl; is on undef hiatus. You can read content, but you can't post it. More info will be forthcoming forthcomingly.

All the Perl that's Practical to Extract and Report

use Perl Log In

Log In

[ Create a new account ]

Ovid (2709)

Ovid
  (email not shown publicly)
http://publius-ovidius.livejournal.com/
AOL IM: ovidperl (Add Buddy, Send Message)

Stuff with the Perl Foundation. A couple of patches in the Perl core. A few CPAN modules. That about sums it up.

Journal of Ovid (2709)

Sunday April 16, 2006
09:30 PM

Class::CGI 0.10

[ #29342 ]

I've just uploaded Class::CGI 0.10 to the CPAN and it should hit mirrors soon. I've finished implementing better error handling and while enhancements to the module are anticipated, it's essentially feature complete. Now you can do stuff like this:

use Class::CGI
    handlers => {
        customer => 'Class::CGI::Customer',
        date     => 'Class::CGI::Date',
        order    => 'Class::CGI::Order',
    };

my $cgi      = Class::CGI->new;
my $customer = $cgi->param('customer');
my $date     = $cgi->param('date');
my $order    = $cgi->param('order');

if ( my @errors = $cgi->errors ) {
    # do error handling
}

Basically, each &param call, if dispatched to a handler, is wrapped in an eval and if an exception is thrown, the method call returns false and an error is pushed onto an internal stack. The &errors method returns those errors (and there's a corresponding method to clear that stack, if needed). By using this strategy, you can attempt to fetch all of your form data at once and report all errors at the same time.

The Fine Print: The following comments are owned by whoever posted them. We are not responsible for them in any way.
 Full
 Abbreviated
 Hidden
More | Login | Reply
Loading... please wait.