[Catalyst] Re: retrieving multiple values from forms
Andrew Rodland
arodland at comcast.net
Tue Dec 18 01:26:53 GMT 2007
On Monday 17 December 2007 05:27:46 pm A. Pagaltzis wrote:
> The *sane* thing is neither.
>
> The sane thing is to have *TWO* methods, one that *always*
> returns a scalar, and one that *always* returns a list. (Or
> rather, an arrayref, because if it’s just a list, it is easy to
> improperly treat it like a scalar, whereas if it’s an arrayref
> it’s impossible to forget to unpack the array when you meant to
> do that.)
>
> Then you can say what you mean, you can say it *easily* either
> way, and the result is always completely determined by what the
> code says and not at all by what the data looks like. Sanity.
Yeah, I can agree with this. I realized the same thing myself... after posting
my original message of course. Teach me to wait a bit longer before hitting
send in the future. Anyway yeah, what I really want is "param_list"
or "param_aref", without any of the actual "CGI compat" of param -- param
just comes closer to my goal than params. Not sure what the ideal behavior
for the "only one" version would be, but params is at least practical. If you
see ARRAY(0xbadfad) where you expected useful data it's not that hard to
trace back and see what you did wrong.
Andrew
More information about the Catalyst
mailing list