[Catalyst] Alternatives to Catalyst ?

Octavian Rasnita orasnita at gmail.com
Mon Apr 26 10:13:19 GMT 2010


From: "Ævar Arnfjörð Bjarmason" <avarab at gmail.com>
...
> Now that it's quietened down, I can ask a question. Does this I mean
> it's preferable to use
>
> $c->req->{parameters}->{foo}
>
> rather than
>
> $c->req->param('foo')
>
> Obviously I'd rather use the faster method but if I'm breaking the
> encapsulation in some ways that's going to bite me later, I'd steer
> clear.

> "Obviously".
>
> Unless you're doing method calls in a tight loop somewhere in your
> code you *shouldn't care about this*. Now I've written code that
> actually *did* suffer from method call overhead but since you're just
> casually asking it's very unlikely that you're doing the same.
>
> Don't sprinkle premature optimizations around your codebase just
> because someone produced a benchmark showing one is faster than the
> other. You should be doing *profiling* of your  entire program, not
> micro-optimizing something that's likely 0.0001% of its total runtime.


If I remember well $c->req->param() is not recommended, but not for 
performance reasons.

It resembles the method with the same name from CGI.pm, and it can return 
not only a scalar value, but it could also return an array if it is called 
in list context. So it might break the code if multiple values were sent for 
the same variable.

Octavian


__________ Information from ESET NOD32 Antivirus, version of virus signature database 5061 (20100426) __________

The message was checked by ESET NOD32 Antivirus.

http://www.eset.com






More information about the Catalyst mailing list