?
Solved

Perl CGI: list post/get param keys

Posted on 2007-10-16
7
Medium Priority
?
2,866 Views
Last Modified: 2013-12-25
perl cgi question:

How do I get a list of defined cgi params from a post/get?

Let's say param('name'), param('address') are defined.

How can I get a list of those names (name, address) without knowing they exist?
0
Comment
Question by:jasonsbytes
  • 3
  • 3
7 Comments
 
LVL 48

Expert Comment

by:Tintin
ID: 20088725
use CGI;
my $query = new CGI;
my @keywords = $query->keywords;
0
 
LVL 17

Author Comment

by:jasonsbytes
ID: 20089069
hmm...

That doesn't seem to return anything.

You see, I'm calling a logging sub from another sub that is doing some stuff and at this point there are several keywords defined already, but I never issued a new CGI; anywhere... i'm just 'use' ing CGI qw/standard/;.  So there are params, like param('blah') and param('blahblah'), but from this logging sub, I want a list of all those keywords (blah, blahblah, etc.).
0
 
LVL 17

Author Comment

by:jasonsbytes
ID: 20089145
i modified the script so it sets a $var = new CGI; and then i reference all the params as $var->param('blah');  However, still i get nothing returned into @keywords for $var->keywords;.
0
Free Tool: Port Scanner

Check which ports are open to the outside world. Helps make sure that your firewall rules are working as intended.

One of a set of tools we are providing to everyone as a way of saying thank you for being a part of the community.

 
LVL 85

Accepted Solution

by:
ozo earned 2000 total points
ID: 20089199
use CGI qw/standard param/;
@keywords = param();
0
 
LVL 48

Expert Comment

by:Tintin
ID: 20089257
OK, so you're using the function interface to the CGI module rather than OO.  In that case, do

use CGI qw/standard keywords/;
@keywords = keywords();
0
 
LVL 48

Expert Comment

by:Tintin
ID: 20089272
Sorry, my mistake.  ozo was correct.
0
 
LVL 17

Author Comment

by:jasonsbytes
ID: 20089324
Thanks Tintin for your time and Ozo for the answer... :)
0

Featured Post

Free Tool: Subnet Calculator

The subnet calculator helps you design networks by taking an IP address and network mask and returning information such as network, broadcast address, and host range.

One of a set of tools we're offering as a way of saying thank you for being a part of the community.

Question has a verified solution.

If you are experiencing a similar issue, please ask a related question

This tutorial will discuss fancy secure registration forms, with AJAX technology support. In this article I assume you already know HTML and some JS. I will write the code using WhizBase Server Pages, so you need to know some basics in WBSP (you mig…
Active Directory replication delay is the cause to many problems.  Here is a super easy script to force Active Directory replication to all sites with by using an elevated PowerShell command prompt, and a tool to verify your changes.
Learn the basics of while and for loops in Python.  while loops are used for testing while, or until, a condition is met: The structure of a while loop is as follows:     while <condition>:         do something         repeate: The break statement m…
Learn how to match and substitute tagged data using PHP regular expressions. Demonstrated on Windows 7, but also applies to other operating systems. Demonstrated technique applies to PHP (all versions) and Firefox, but very similar techniques will w…
Suggested Courses
Course of the Month16 days, 22 hours left to enroll

864 members asked questions and received personalized solutions in the past 7 days.

Join the community of 500,000 technology professionals and ask your questions.

Join & Ask a Question