Question on param()

Bobby Kleemann rkleeman at neta.com
Tue Aug 8 20:31:24 CDT 2000


~sdpm~
Whether called as a method of an object or as a seperate function, param()
returns the list of parameters passed to a function, or if a value is
given to param, the value(s) of that parameter.

>From http://search.cpan.org/doc/LDS/CGI.pm-2.70/CGI.pm



FETCHING THE NAMES OF ALL THE PARAMETERS PASSED TO
YOUR SCRIPT: 

     @names = $query->param


If the script was invoked with a parameter list (e.g.
"name1=value1&name2=value2&name3=value3"), the param() method will return
the parameter names as a list. If the script was invoked as an <ISINDEX>
script and contains a string without ampersands (e.g.
"value1+value2+value3") , there will be a single parameter named
"keywords" containing the "+"-delimited keywords.

NOTE: As of version 1.5, the array of parameter names returned will be in
the same order as they were submitted by the browser. Usually this order
is the same as the order in which the parameters are defined in the form
(however, this isn't part of the spec, and so isn't guaranteed).

FETCHING THE VALUE OR VALUES OF A SINGLE NAMED PARAMETER:

    @values = $query->param('foo');


              -or-


    $value = $query->param('foo');


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 a value is not given in the query string, as in the queries
"name1=&name2=" or "name1&name2", it will be returned as an empty string.
This feature is new in 2.63.

 _ _ _
 Bobby Kleemann <rkleeman at neta.com>
 http://www.neta.com/~rkleeman/

On Tue, 8 Aug 2000, C. Abney wrote:

> ~sdpm~
> On Tue, 8 Aug 2000, Alan Stewart wrote:
> 
> > I tried the following:
> > 
> >   ### test ###
> [snippage happens]
> >   ### end test ###
> > 
> > and it works for me. I think the problem is a combination of logic and HTML. 
> 
> So what's happening there?  You treat param as a method call to an object
> and it returns whatever the call returns (null or 'has params', here.)
> 
> Mike tried it as what, an exported function call?  In that case what is it
> that's being returned, a CODE reference?
> 
> CA
> -- 
> Mighty Mouse is a cartoon. Superman is a real guy. No way a cartoon could beat
> up a real guy! -- Teddy                                               C. Abney
> 
> ~sdpm~
> 
> The posting address is: san-diego-pm-list at hfb.pm.org
> 
> List requests should be sent to: majordomo at hfb.pm.org
> 
> If you ever want to remove yourself from this mailing list,
> you can send mail to <majordomo at happyfunball.pm.org> with the following
> command in the body of your email message:
> 
>     unsubscribe san-diego-pm-list
> 
> If you ever need to get in contact with the owner of the list,
> (if you have trouble unsubscribing, or have questions about the
> list itself) send email to <owner-san-diego-pm-list at happyfunball.pm.org> .
> This is the general rule for most mailing lists when you need
> to contact a human.
> 

~sdpm~

The posting address is: san-diego-pm-list at hfb.pm.org

List requests should be sent to: majordomo at hfb.pm.org

If you ever want to remove yourself from this mailing list,
you can send mail to <majordomo at happyfunball.pm.org> with the following
command in the body of your email message:

    unsubscribe san-diego-pm-list

If you ever need to get in contact with the owner of the list,
(if you have trouble unsubscribing, or have questions about the
list itself) send email to <owner-san-diego-pm-list at happyfunball.pm.org> .
This is the general rule for most mailing lists when you need
to contact a human.




More information about the San-Diego-pm mailing list