[Catalyst] Re: Alternatives to Catalyst ?

Zbigniew Lukasiak zzbbyy at gmail.com
Tue Apr 27 07:12:23 GMT 2010


On Mon, Apr 26, 2010 at 11:59 PM, Aristotle Pagaltzis <pagaltzis at gmx.de> wrote:
> * Zbigniew Lukasiak <zzbbyy at gmail.com> [2010-04-26 12:25]:
>> This is a fine advice - but unfortunately the ->param method
>> call suffers from additional problem - which is described in
>> much detail in the documentation (go to the NOTE at:
>> http://search.cpan.org/~bobtfish/Catalyst-Runtime-5.80022/lib/Catalyst/Request.pm#$req-%3Eparam).
>
> Yeah, but the ->params hash has the converse problem: if you
> write
>
>    $c->model->insert_person( name => $c->req->params->{'name'} )
>
> then you may be surprised to find out there are people with name
> like ARRAY(0xDEADBEEF). Of course that’s just a relatively minor
> case of data corruption. Worse is if you legitimately expect
> a parameter to have one or more values, eg. a pile of checkboxes.
> Then you have to constantly check whether you’re getting a scalar
> or an array reference.
>
> So either you use the legacy method and have to protect against
> getting more values than you wanted, or you use the suggested
> method and have to protect against getting fewer values than you
> expect in the general case.
>
> I briefly tried to write something to stick Hash::MultiValue into
> Catalyst to end the madness, but doing it properly would require
> a plugin, plus HTTP::BodyParser (I think) was using a misdesigned
> approach that made deep integration of H::MV impossible (with
> properly preserved k/v pair order).
>
> Could have written a Request role… but that seemed unsatisfying.
>
> I wonder whether it would be possible to rip out the respective
> bits from Cat and use just H::MV, and leave the current stuff to
> a compat plugin or something like that…

Not a very concrete answer - but I remember that Miyagawa talked about
fixing that in Plack::Request (and I am not sure but I think it also
involved H::MV) - so there might be some occasion for reuse :)

Cheers,
Z.

>
> Regards,
> --
> Aristotle Pagaltzis // <http://plasmasturm.org/>
>
> _______________________________________________
> List: Catalyst at lists.scsys.co.uk
> Listinfo: http://lists.scsys.co.uk/cgi-bin/mailman/listinfo/catalyst
> Searchable archive: http://www.mail-archive.com/catalyst@lists.scsys.co.uk/
> Dev site: http://dev.catalyst.perl.org/
>



-- 
Zbigniew Lukasiak
http://brudnopis.blogspot.com/
http://perlalchemy.blogspot.com/



More information about the Catalyst mailing list