[Catalyst] html-widget bug or design?

Christopher H. Laco claco at chrislaco.com
Wed Mar 1 19:46:45 CET 2006


Matt S Trout wrote:
> On Wed, Mar 01, 2006 at 03:15:25PM -0300, Nilson Santos Figueiredo Junior wrote:
>> On 3/1/06, A. Pagaltzis <pagaltzis at gmx.de> wrote:
>>> Please don't. Every time I have to use such an API it makes me
>>> cry. :-( Making the type of the return value dependent on its
>>> value is a breathtaking pain in the rear end. It causes code
>>> that's gunked up with gobs of `ref $foo eq 'ARRAY'` checks.
>> I'm not sure when you'd need to actually check anything like that.
>>
>> If you want an array ref call it like:
>>
>> my $result = Class->method;
>>
>> If you want a list of values call it like:
>>
>> my ($result) = Class->method;
>>
>> I, myself, actually like this sort of API since it allows *me* to
>> choose what's more convenient instead of relying on the module
>> author's choice.
> 
> Unless you're running under Template Toolkit, in which case the choice is
> always "list context".
> 

Right. I learned that the hard way in Handel. :-/

-------------- next part --------------
A non-text attachment was scrubbed...
Name: signature.asc
Type: application/pgp-signature
Size: 187 bytes
Desc: OpenPGP digital signature
Url : http://lists.rawmode.org/pipermail/catalyst/attachments/20060301/32bea309/attachment.pgp 


More information about the Catalyst mailing list