in reply to OT- Web Error Message Haiku

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

Replies are listed 'Best First'.
Re: Re: OT- Web Error Message Haiku
by Hero Zzyzzx (Curate) on Sep 27, 2001 at 22:01 UTC

    Thanks merlyn!

    And thanks for the handler! God, I love mod_perl. I actually tried out your 404-Coy setup on the urging of one of your other posts. I know this whole idea is on the verge of being trite, but I thought it might be worth doing anyway. It would be nice to build up a collection of human made haiku, I think we could get some pretty good ones. . .

    -Any sufficiently advanced technology is
    indistinguishable from doubletalk.