Beefy Boxes and Bandwidth Generously Provided by pair Networks
Welcome to the Monastery
 
PerlMonks  

Newbie needs to know more about param()

by spork (Monk)
on Apr 21, 2002 at 01:56 UTC ( [id://160832]=perlquestion: print w/replies, xml ) Need Help??

spork has asked for the wisdom of the Perl Monks concerning the following question:

I have looked through the halls of the Monastery for documentation on param.

My problem is that I will set a parameter and use it in a function. The next time I call that function the parameter's value is empty. I did not delete or alter its contents. It simply up and vanished.

I don't like to ask questions if there is some other resource avaiable that will give me the info I need. I have looked (and looked and looked...) and experimented but I am dumbfounded. What is happening to my params??? If someone could simply point me to a link or can give me a quick answer I'd really appreciate it.

Thanks

  • Comment on Newbie needs to know more about param()

Replies are listed 'Best First'.
Re: Newbie needs to know more about param()
by jerrygarciuh (Curate) on Apr 21, 2002 at 02:09 UTC
    Update: crazyinsomniac kindly pointed out that this valuable piece of info was left out of my post:
    $CGI::revision = '$Id: CGI.pm,v 1.49 2001/02/04 23:08:39 lstein Exp $' +; $CGI::VERSION='2.752';
    Below you will find lines 272 - 312 of CGI.pm of which param() is a method. There is a WHOLE lot more documentation on param() in CGI.pm 's pod.
    HTH
    jg
    #### Method: param # Returns the value(s)of a named parameter. # If invoked in a list context, returns the # entire list. Otherwise returns the first # member of the list. # If name is not provided, return a list of all # the known parameters names available. # If more than one argument is provided, the # second and subsequent arguments are used to # set the value of the parameter. #### sub param { my($self,@p) = self_or_default(@_); return $self->all_parameters unless @p; my($name,$value,@other); # For compatibility between old calling style and use_named_parame +ters() style, # we have to special case for a single parameter present. if (@p > 1) { ($name,$value,@other) = rearrange([NAME,[DEFAULT,VALUE,VALUES]],@p +); my(@values); if (substr($p[0],0,1) eq '-') { @values = defined($value) ? (ref($value) && ref($value) eq 'AR +RAY' ? @{$value} : $value) : (); } else { foreach ($value,@other) { push(@values,$_) if defined($_); } } # If values is provided, then we set it. if (@values) { $self->add_parameter($name); $self->{$name}=[@values]; } } else { $name = $p[0]; } return unless defined($name) && $self->{$name}; return wantarray ? @{$self->{$name}} : $self->{$name}->[0]; }
    _____________________________________________________
    Think a race on a horse on a ball with a fish! TG
Re: Newbie needs to know more about param()
by Fletch (Bishop) on Apr 21, 2002 at 02:34 UTC

    No one is going to be able to point you at anything that can be guaranteed to help since you've neglected to post any sort of code which exhibits the behavior you claim to be seing. For all we know it's due to interference from orbital mind control lasers and your computer doesn't have a thick enough layer of tin foil on top of it.

Log In?
Username:
Password:

What's my password?
Create A New User
Domain Nodelet?
Node Status?
node history
Node Type: perlquestion [id://160832]
Approved by rob_au
help
Chatterbox?
and the web crawler heard nothing...

How do I use this?Last hourOther CB clients
Other Users?
Others pondering the Monastery: (4)
As of 2024-04-19 20:51 GMT
Sections?
Information?
Find Nodes?
Leftovers?
    Voting Booth?

    No recent polls found