(I debated putting this in the "News" section, but some might not consider this news.)

I have just set up an email list for Class::CGI. If you're interested in using Class::CGI, having design discussions, wish to contribute patches, etc., then please sign up for the list. Development is ongoing and I look forward to having others have a role in the evolution of this module.

New handlers I am thinking about:

Class::CGI::Email::Valid
Validate email addresses. Will not untaint them.
Class::CGI::Digest::SHA1
Verify that form parameters have not been altered.
Class::CGI::Digest::MD5
Verify that form parameters have not been altered.
Class::CGI::Number::Phone
Validate and return Number::Phone objects (could be tricky).
Class::CGI::CreditCard
Validate and return a Business::CreditCard::Object.

Also note that I am not bundling these in the Class::CGI distribution as folks should be able to pick and choose which handlers they wish to implement. I will, however, be creating a Bundle::Class::CGI for folks who want all of it.

Other planned features are support for "required" fields. The API I envision looks like this:

use Class::CGI profiles => $profile_file, required => [qw/customer order email/];

Of course, specifying the handlers in your code directly should also work:

use Class::CGI handlers => { customer => 'Handler::Customer', order => 'Handler::Order', email => 'Class::CGI::Email::Valid', phone => 'Class::CGI::Phone::Number', required => [qw/customer order email/];

This raises some interesting design questions. For example, the "customer" parameter may be a virtual parameter comprised of "first_name", "last_name", "address", and so on. Because Class::CGI merely delegates those parameters to handlers, it cannot know whether or not those are virtual parameters. Thus, the handlers will be responsible for checking if they're required and reporting if they are missing.

I also need to support a distinction between "invalid" and "missing" parameters and overriding error messages so you can customize them for your site. I welcome feedback from folks on what they would like to see.

Yet another feature which may be important is allowing one to fetch the form data from something other than CGI::Simple, while retaining that as the base class. I have a way of making that very simple, but that's another discussion entirely. The major aim is to make the simple things simple, the hard things possible, and keeping the code as simple as possible. Feature creep is inevitable, but I strongly, strongly desire to keep things small. It's OK if handlers become a bit more complicated to write as they'll be "write and forget" code. It's the day-to-day application code which must be so ridiculously simple that the end-users need not worry about the difficult bits.</>

Cheers,
Ovid

New address of my CGI Course.

Replies are listed 'Best First'.
Re: Class::CGI Mailing List
by apotheon (Deacon) on Apr 27, 2006 at 12:10 UTC

    Truthfully, it looks more like news than a meditation to me, even if not by much. I'm glad you stuck it in Meditations anyway, though, since I probably wouldn't have seen it this morning if you'd stuck it in News instead. I check Meditations a lot more often.

    I'm pretty keen on Class::CGI, as you've described it, and will be looking into it in more depth. I'm a fan of simplicity when it comes to stuff like this. I guess you could call it the "utility" approach: write stuff like it's a simple utility that "does one thing well" rather than a huge "feature-rich" application suite that does a whole long list of things to a strict standard of mediocrity with an interface too complex to even dream of really mastering.

    Maybe this is just my unixy bias showing through.

    print substr("Just another Perl hacker", 0, -2);
    - apotheon
    CopyWrite Chad Perrin