[Catalyst] Alternatives to Catalyst ?

Merlyn Kline merlyn at zynet.net
Tue Apr 27 09:14:26 GMT 2010


I'm running out of popcorn now so here's a quick summary of my observations
WRT getting request parameters:

- If a simple question about something so fundamental to what Catalyst is
for (i.e. Dermot's question, not Oleg's) can generate so much debate then
something's not right somewhere. Hopefully, in the docs.

- Three methods of getting CGI parameters have been mentioned:
  - $c->req->{parameters}->{name}
    Undocumented, dangerous, used only by lunatics and trolls.
  - $c->req->param(name)
    Documented legacy interface, deprecated (but unfortunately the only
    one mentioned in Catalyst/Manual/Intro.pod#Query_Parameter_Processing).
  - $c->req->param[eter]s->{name}
    The correct encapsulation - use this.

- CS101: premature optimisation is the root of much evil but OTOH it's a
good idea to be in the habit of using optimal methods when there's a choice
not dictated by other factors. But that's not actually relevant here.

- It's nice to answer people's questions without making assumptions about
their context. OTOH additional advice which turns out to be irrelevant is
free so we shouldn't scorn it. OTOH it can be off-putting to people trying
find their way through the information overload as they start using a new
system as complex as Catalyst. OTOH complaining about it just causes bad
feeling so we shouldn't do that. OTOH complaining about complaints is no
different from complaining about anything else. OTOH this loop has no exit
condition. break;

So I had a quick look at the docs (for the first time in many years - I
found them at http://search.cpan.org/~hkclark/Catalyst-Manual/) to see if I
could see what this is all about. The answer to Dermot's question is there
but it it's a bit obscured by the CGI.pm combatability aspect - that was
very important at the start of Catalyst's life (because most users would be
coming from there) but probably isn't so much any more. In particular, as
mentioned above, Catalyst/Manual/Intro.pod#Query_Parameter_Processing really
only talks about the req->param() interface. I propose that all references
to the req->param() interface should be replaced by references to the
$c->req->parameters->{} interface except where explicit discussions of
CGI.pm compatability are appropriate, which would only be very briefly in
the case of the Intro. I'm afraid I don't know how to do this but if someone
sends me a pointer to instructions I'll have a go at making a doc patch or
whatever's appropriate.

Merlyn




More information about the Catalyst mailing list