[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

RE: [cgiapp] CGI::Application 3.0


On Sun, 2 Feb 2003, Jesse Erlbaum wrote:
> Yes, this is the most significant change in the new version.  While the
> code change is not very big, the new interface is:
> 
>     $self->run_modes(
>         show_form     => 'show_form',
>         add_thingy    => 'add_thingy',
>         insert_thingy => 'insert_thingy',
>         edit_thingy   => 'edit_thingy',
>         update_thingy => 'update_thingy',
>         delete_thingy => 'delete_thingy',
>     );
> 
>  ...Can now be said more simply:
> 
>     $self->run_modes([
>        'show_form',
>        'add_thingy',
>        'insert_thingy',
>        'edit_thingy',
>        'update_thingy',
>        'delete_thingy',
>   ]);

I really like this idea, but I run into one problem when trying to apply 
it to my cgiapp's.  98% of my cgiapp run_modes would work fine with the 
above.  But the other 2% are mapped to some 'common' run_mode like 
'unimplemented'.  I do this sort of thing for a variety of reasons, but 
primarily because I can put up a decent error message.  From looking at 
the quoted code I'm guessing that calling run_modes multiple times, once 
with an array and the other with a hash wouldn't work.  Am I confused or 
is there some other way around this?

And it'd be good I think for an example such as this to appear in the 
docs:

     $self->run_modes([qw(
        show_form
        add_thingy
        insert_thingy
        edit_thingy
        update_thingy
        delete_thingy
     )]);

-- 
</chris>

"Never offend people with style when you can offend them with substance."
		- Sam Brown 


---------------------------------------------------------------------
Web Archive:  http://www.mail-archive.com/suppressed/
To unsubscribe, e-mail: suppressed
For additional commands, e-mail: suppressed


Mail converted by mhonarc 2.6.15
This archive provided courtesy of JSW4.NET, Internet Hosting Services for Small Business.