I've already got one wired up with Coy on my site. In my conf file:
ErrorDocument 404 /perl/404-handler
and of course /perl is Apache::Registry marked. And at 404-handler I have:
#!/usr/bin/perl -w use strict; print STDERR join (" ", map "[$_]", scalar localtime, "404 ERROR PERL", map { $ENV{$_} || "-" } qw(REDIRECT_URL REMOTE_HOST HTTP_REFERER)), "\n"; my $red_url = $ENV{REDIRECT_URL} || "?unknown?"; { local $ENV{HOME} = "/home/merlyn/lib/Stonehenge"; require Coy; } my $haiku = Coy::with_haiku("URL $red_url not found"); for ($haiku) { s/&/&amp;/g; s/</&lt;/g; s/>/&gt;/g; s/^\t/&nbsp;&nbsp;&nbsp;&nbsp;/gm; s/ /&nbsp;/g; s/\n/<br>/g; } (my $red_html = $red_url) =~ s/[\x00-\x20"<&>"\x80-\xff]/&\#@{[ord$&]} +\;/g; my $tp_link = ""; if ($red_url =~ /^\/~/) { for ("http://www.teleport.com/$red_html") { $tp_link = <<"DQ"; <p>Perhaps you were looking for something at Teleport's web-server, such as <a href="/cgi/go/$_">$_</a>? DQ } } print <<"DQ"; Content-type: text/html Status: 404 Not Found <head><title>File Not Found</title></head> <body><h1>File Not Found</h1> <p>$haiku <p>The requested URL $red_html was not found on this server. $tp_link <p>Try looking at the <a href="/">our home page</a> as well. </body></html> DQ print " " x 512; # stupid IE

-- Randal L. Schwartz, Perl hacker


In reply to Re: OT- Web Error Message Haiku by merlyn
in thread OT- Web Error Message Haiku by Hero Zzyzzx

Title:
Use:  <p> text here (a paragraph) </p>
and:  <code> code here </code>
to format your post, it's "PerlMonks-approved HTML":



  • Posts are HTML formatted. Put <p> </p> tags around your paragraphs. Put <code> </code> tags around your code and data!
  • Titles consisting of a single word are discouraged, and in most cases are disallowed outright.
  • Read Where should I post X? if you're not absolutely sure you're posting in the right place.
  • Please read these before you post! —
  • Posts may use any of the Perl Monks Approved HTML tags:
    a, abbr, b, big, blockquote, br, caption, center, col, colgroup, dd, del, details, div, dl, dt, em, font, h1, h2, h3, h4, h5, h6, hr, i, ins, li, ol, p, pre, readmore, small, span, spoiler, strike, strong, sub, summary, sup, table, tbody, td, tfoot, th, thead, tr, tt, u, ul, wbr
  • You may need to use entities for some characters, as follows. (Exception: Within code tags, you can put the characters literally.)
            For:     Use:
    & &amp;
    < &lt;
    > &gt;
    [ &#91;
    ] &#93;
  • Link using PerlMonks shortcuts! What shortcuts can I use for linking?
  • See Writeup Formatting Tips and other pages linked from there for more info.