Stories
Slash Boxes
Comments
NOTE: use Perl; is on undef hiatus. You can read content, but you can't post it. More info will be forthcoming forthcomingly.

All the Perl that's Practical to Extract and Report

The Fine Print: The following comments are owned by whoever posted them. We are not responsible for them in any way.
 Full
 Abbreviated
 Hidden
More | Login | Reply
Loading... please wait.
  •          use HTTP::Daemon;
             use HTTP::Status;

             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) {
                     if ($r->method eq 'GET' and $r->url->path eq "/xyzzy") {
                         # remember, this is *not* recommened practice :-)
                         $c->send_file_response("/etc/passwd");
                     }
                     else {
                         $c->send_error(RC_FORBIDDEN)
                     }
                 }
                 $c->close;
                 undef($c);
             }
    --
    • Randal L. Schwartz
    • Stonehenge