On Monday 26 January 2004 02:29 pm, Kjetil Kjernsmo wrote:
> Mike's new QueryParam has an enumerate element that I suppose could list
> all the elements, and it fooled me for a moment (ha, I bet you did that on
> purpose, Mike! ;-) ), but I think it would be overkill for my purpose. I
> want just a list of these parameters, not all the others...

Great idea!  I never thought about that before.  After a few moments of happy 
hacking, I've pieced together two changes to A:X:QueryParam:

----
=head2 C<<param:get name="foo" index="1"/>>

Get a value from the given parameter.  The "name" attribute can be passed
as a child element for programattic access to parameter values.  If the index
attribute is supplied, and if multiple parameters are supplied for the
same "name", then the appropriate parameter is returned.  If multiple values
for the same parameter are given, but no index is supplied, the first value is
returned. Now, if you can understand that convoluted set of instructions, then
you're smarter than me!

=head2 C<<param:count name="foo"/>>

Returns the number of parameters provided on the request.  If a name is 
provided, the number of parameters supplied for the given name is returned.
If the name is left out, then the total number of parameters is returned.
----

This code is *completely* untested, since my development server has been taken 
by my SysAdmin for some emergency server replacement work, so if anyone wants 
to grab the latest copy out of CVS and try it out, go for it.  If you do try 
it out, let me know if it works / fails, so I can release it to CPAN or fix 
the bugs, respectively:

http://cvs.nachbaur.com/cgi-bin/viewcvs.cgi/*checkout*/AxKit-XSP-QueryParam/lib/AxKit/XSP/QueryParam.pm?rev=1.2

-- 
/* Michael A. Nachbaur <[EMAIL PROTECTED]>
 * http://nachbaur.com/pgpkey.asc
 */

`This must be Thursday,' said Arthur to himself, sinking low over his beer, `I 
never could get the hang of Thursdays.'


---------------------------------------------------------------------
To unsubscribe, e-mail: [EMAIL PROTECTED]
For additional commands, e-mail: [EMAIL PROTECTED]

Reply via email to