[Maypole-dev] [PATCH] add param() method to application object

From: Simon Flack (sf at flacks.net)
Date: Thu Sep 09 2004 - 23:32:22 BST


A controversial patch perhaps, but I thought I'd put something together and
let the community decide...

It follows fairly closely the behaviour of CGI.pm and A::R's param() method
(WRT fetching params only). From the CGI docs:

   Pass the param() method a single argument to fetch the
   value of the named parameter. If the parameter is
   multivalued (e.g. from multiple selections in a scrolling
   list), you can ask to receive an array. Otherwise the
   method will return a single value.

   If the parameter does not exist at all, then param() will
   return undef in a scalar context, and the empty list in a
   list context.

This behaviour should be familiar to perl web developers. With the current
(svn snapshot) implimentation of Maypole, authors need to check whether a
single value or multiple values were submitted. param() should simplify
things.

It should work for any Maypole front-end that stores parameters in the
'params' slot. Other front-ends can impliment their own param() if required.

If accepted, it should be documented somewhere. Maypole.pm's documentation
seems to be an overview, mostly duplicating information in the docs/ folder.
What's the plan for documentation and how can we help?

--simonflk



_______________________________________________
maypole-dev mailing list
maypole-dev at lists.netthink.co.uk
http://lists.netthink.co.uk/listinfo/maypole-dev



This archive was generated by hypermail 2.1.3 : Thu Feb 24 2005 - 22:25:56 GMT