[Catalyst] CGI::State style Plugin?
Jim Spath
jspath at pangeamedia.com
Fri Feb 9 22:06:59 GMT 2007
Ash Berlin wrote:
> Jim Spath wrote:
>> I was considering using the following module in my Catalyst app.
>>
>> http://search.cpan.org/~dkubb/CGI-State-0.02/State.pm
>>
>> Until I saw that it does a "use CGI;", the only purpose of which is
>> for the creation of a CGI object if you don't pass one in.
>>
>> So I went ahead and wrote a plugin for Catalyst that provides the same
>> functionality using $c->request. This was partially because I want
>> the functionality that CGI::State provides and partially to learn a
>> little more about Catalyst.
>>
>> I had a few questions about it:
>>
>> - Should I call it Catalyst::Plugin::CGI::State or something else? I
>> was thinking of something like Catalyst::Plugin::StructureParams, but
>> I wasn't sure since it's based so heavily off CGI::State. On the
>> other hand, it doesn't use CGI or CGI::State anymore.
>>
>> - It would most likely provide two methods
>> my $structure = $c->params_to_structure;
>> $c->structure_to_params($structure)
>> Do these names make sense? Are they acceptable?
>>
>> - Does anyone think this plugin is worth releasing publicly?
>>
>> Thanks!
>> - Jim
>
> Have you looked at Catalyst::Plugin::Params::Nested to see if that does
> what you want first?
>
> Ash
I had not, thanks!
Looks interesting, but it doesn't provide for arrays?
Also, my plugin wouldn't alter $c->request->params, and the
$c->params_to_structure method it provides wouldn't be called
automatically for every request... it would need to be called manually.
This isn't something I would expect to need on every form.
Also, I had planned on providing a method for reading a data structure
into $c->request, something that could be useful for prefilling forms
based on a complex data structure.
Jim
More information about the Catalyst
mailing list