Consulte libwww-perl.
pp2@nereida:~/src/testing$ cat -n httpdaemon.pl 1 #!/usr/bin/perl -w 2 use strict; 3 4 use HTTP::Daemon; 5 use HTTP::Status; 6 7 my $d = HTTP::Daemon->new || die; 8 print "Please contact me at: <URL:", $d->url, ">\n"; 9 while (my $c = $d->accept) { 10 while (my $r = $c->get_request) { 11 if ($r->method eq 'GET' and $r->url->path eq "/xyzzy") { 12 # remember, this is *not* recommended practice :-) 13 $c->send_file_response("/etc/passwd"); 14 } 15 else { 16 $c->send_error(RC_FORBIDDEN) 17 } 18 } 19 $c->close; 20 undef($c); 21 }
Casiano Rodríguez León