By multiple values did you mean like a multi-selection
box? I think that HTTP::Request will handle that with
a simple array ref for the value...
use HTTP::Request::Common;
use LWP::UserAgent;
$ua = LWP::UserAgent->new;
my $res =$ua->request( POST 'http://localhost/cgi-bin/printenv',
{ Who => 'Mark', Why => 'Because',
FavColors => ['Blue', 'Red', 'Yellow'],
Hair => 'Balding',
Etc => 'More Examples'
}
);
print $res->content;
One hasty modification to printenv gives me:
#!/usr/bin/perl
use CGI 'param';
print "Content-type: text/html\n\n";
while (($key, $val) = each %ENV) {
print "$key = $val<BR>\n";
}
print "<hr>\n";
print "$_ = ".join (", ",param($_))."<BR>\n" for param;
## returns ...
QUERY_STRING = <BR>
CONTENT_TYPE = application/x-www-form-urlencoded<BR>
SERVER_PROTOCOL = HTTP/1.0<BR>
SERVER_SIGNATURE = <ADDRESS>Apache/1.3.6 Server at Ruby.hostile.org Po
+rt 80</ADD
RESS>
<BR>
REMOTE_PORT = 1062<BR>
HTTP_USER_AGENT = libwww-perl/5.48<BR>
GATEWAY_INTERFACE = CGI/1.1<BR>
HTTP_HOST = localhost<BR>
SERVER_SOFTWARE = Apache/1.3.6 (Unix) (SuSE/Linux)<BR>
SERVER_ADMIN = root@localhost<BR>
REMOTE_ADDR = 127.0.0.1<BR>
SCRIPT_NAME = /cgi-bin/printenv<BR>
SERVER_NAME = Ruby.hostile.org<BR>
DOCUMENT_ROOT = /usr/local/httpd/htdocs<BR>
REQUEST_URI = /cgi-bin/printenv<BR>
UNIQUE_ID = OoTdKsCoAP4AAFYnESI<BR>
REQUEST_METHOD = POST<BR>
CONTENT_LENGTH = 99<BR>
SCRIPT_FILENAME = /usr/local/httpd/cgi-bin/printenv<BR>
PATH = /sbin:/bin:/usr/sbin:/usr/bin<BR>
SERVER_PORT = 80<BR>
<hr>
Etc = More Examples<BR>
Hair = Balding<BR>
FavColors = Blue, Red, Yellow<BR>
Who = Mark<BR>
Why = Because<BR>
--
$you = new YOU;
honk() if $you->love(perl) |