Velocity Reviews - Computer Hardware Reviews

Velocity Reviews > Newsgroups > Programming > Perl > Perl Misc > sub param in CGI.pm

Reply
Thread Tools

sub param in CGI.pm

 
 
Keith Keller
Guest
Posts: n/a
 
      08-20-2003
-----BEGIN PGP SIGNED MESSAGE-----
Hash: SHA1

In article <>, hudson wrote:
> OK...I dug up the subroutine called param in CGI.pm. Anyone care to give me a little insight into it?


What sort of insight are you seeking? Specific questions about lines
of code would be more helpful. (Followup your original post if
you want to do that.)

- --keith

- --
kkeller-
(try just my userid to email me)
AOLSFAQ=http://wombat.san-francisco.ca.us/cgi-bin/fom

-----BEGIN PGP SIGNATURE-----
Version: GnuPG v1.0.6 (GNU/Linux)
Comment: For info see http://www.gnupg.org

iEYEARECAAYFAj9CwqYACgkQhVcNCxZ5ID/flQCeP7jQBKbHxlYNxlNeGku7WPgH
qA4Anja5tX5BRpbpkpafNkEX7vjTYsC+
=fUeq
-----END PGP SIGNATURE-----
 
Reply With Quote
 
 
 
 
hudson
Guest
Posts: n/a
 
      08-20-2003
OK...I dug up the subroutine called param in CGI.pm. Anyone care to give me a little insight into it?

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_parameters() 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 'ARRAY' ? @{$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];
}
 
Reply With Quote
 
 
 
 
hudson
Guest
Posts: n/a
 
      08-20-2003
On Tue, 19 Aug 2003 17:36:55 -0700, Keith Keller
<kkeller-> wrote:

>What sort of insight are you seeking? Specific questions about lines
>of code would be more helpful. (Followup your original post if
>you want to do that.)


ahh well...maybe you are right and I am asking other people to do work
for me....sorry about that

to explain the post better, though, people here have told me many
times I can't live without CGI.pm ....so I would like to know exactly
what that module does that I can't understand.

anyway, you are right...I really should read the code myself for a
week or a month and come back later with specific questions instead of
asking for a general walkthrough right off the bat

 
Reply With Quote
 
 
 
Reply

Thread Tools

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is On
HTML code is Off
Trackbacks are On
Pingbacks are On
Refbacks are Off


Similar Threads
Thread Thread Starter Forum Replies Last Post
Death To Sub-Sub-Sub-Directories! Lawrence D'Oliveiro Java 92 05-20-2011 06:50 AM
HTML::Template->param() : You gave me an odd number of parameters to param()! Dave Perl Misc 5 04-26-2011 02:44 AM
Recognising Sub-Items and sub-sub items using xslt Ben XML 2 09-19-2007 09:35 AM
Overload by deriv class param; call w base class param ectoplasm C++ 12 07-28-2005 08:20 AM
XSLT: How to replace param name with this param's value ? Geathaa XML 2 07-30-2003 06:48 AM



Advertisments
 



1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 53 54 55 56 57