>Good day, all. I currently have some code that use HTTP::Daemon and CGI.pm
>in one script: the HTTP::Daemon portion listens for requests, and sends
>relevant GET or POST information off to CGI.pm, where it's used throughout
>the whole program, non-OOP. The shell is something like this:
Here's a reproducible mini-test:
#!/usr/bin/perl -w
use strict;
use HTTP::Daemon;
use CGI 2.50 qw/:standard :cgi-lib/;
my $d = HTTP::Daemon->new || die;
print "Please contact me at: <URL:", $d->url, ">\n";
while (my $c = $d->accept) {
while (my $r = $c->get_request) {
my $form_parameters;
if ( $r->uri =~ /\?/ ) {
$form_parameters = $r->uri;
$form_parameters =~ s/[^\?]+\?(.*)/$1/;
} else { $form_parameters = $r->content; }
$CGI::Q = new CGI($form_parameters);
my $param = param("hello");
print "Content-type: text/plain\n\n";
print "I saw: $param\n";
use Data::Dumper;
print Dumper(\%ENV);
}
$c->close;
undef($c);
}
The first line printed will be the value of "hello".
The second is the environment, showing a lack of CONTENT_TYPE.
GET works fine. Creating your own HTML form with POST
(be sure to replace the action with the correct URL):
<form action=" " method="post">
<input type="input" name="hello" value="morbus">
<input type="submit" name="go">
</form>
works correctly, but the minute you add enctype, it doesn't:
<form action=" " method="post" enctype="multipart/form-data">
<input type="input" name="hello" value="morbus">
<input type="submit" name="go">
</form>
--
Morbus Iff ( i put the demon back in codemonkey )
Culture: http://www.disobey.com/ and http://www.gamegrene.com/
Spidering Hacks: http://amazon.com/exec/obidos/ASIN/0596005776/disobeycom
icq: 2927491 / aim: akaMorbus / yahoo: morbus_iff / jabber.org: morbus
|
Try Searching:
servers, voip, java, networking, microsoft ...
|
|
|
|