[Catalyst] html-widget bug or design?

Nilson Santos Figueiredo Junior acid06 at gmail.com
Wed Mar 1 19:15:25 CET 2006


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.

If you want consistent results, just code consistently.

-Nilson Santos F. Jr.



More information about the Catalyst mailing list