Beefy Boxes and Bandwidth Generously Provided by pair Networks
No such thing as a small change

(very silly) BOFH::Easy (instantiated in Net::Telnet)

by arturo (Vicar)
on May 14, 2001 at 18:23 UTC ( #80208=snippet: print w/ replies, xml ) Need Help??

Description: Queries the BOfH excuse server and returns an excuse. Reference: BOFH::Easy

use strict;
use Net::Telnet;

print get_excuse(), "\n";

sub get_excuse {

        my $t = Net::Telnet->new(Host=>"",
        while (my $line = $t->getline()) {
                next unless $line =~/Your excuse is: (.*)/;
                return ucfirst $1;
Comment on (very silly) BOFH::Easy (instantiated in Net::Telnet)
Download Code
Replies are listed 'Best First'.
Don't use Net::Telnet when IO::Socket::INET will do!
by merlyn (Sage) on May 14, 2001 at 18:54 UTC
    No need to invoke all that very heavy and possibly not installed Net::Telnet stuff. Just open the socket!
    #!/usr/bin/perl use strict; use IO::Socket::INET; my $c = IO::Socket::INET->new("") or die "connect: $@ +"; while (<$c>) { next unless /Your excuse is: (.*)/; print ucfirst $1, "\n"; exit; }
    Use Net::Telnet when there'll be terminal-like interaction with prompts and telnet protocol things. If it's just a socket, use the socket code!

    -- Randal L. Schwartz, Perl hacker

Re: (very silly) BOFH::Easy (instantiated in Net::Telnet)
by oakbox (Chaplain) on May 21, 2002 at 13:17 UTC

    Just for funsies, I slipped this snippet into my former company's error handler CGI. (a simple CGI that caught ErrorDocument redirects from Apache, then printed an appropriate HTML message based on the code).
    On top of the 'real' message, I put in the output of this snippet. I ran it 30 or 40 times, funny, not too risque for my boss. No problemo.
    2 months later, I am called by the secretary asking why our web site is saying that she has sex with the boss's 8 year old son. There, in living HTML was a BOFH message on her screen.

    JUST IN CASE you were thinking about putting this in a 'real' place. Don't :)

Back to Snippets Section

Log In?

What's my password?
Create A New User
Node Status?
node history
Node Type: snippet [id://80208]
and the web crawler heard nothing...

How do I use this? | Other CB clients
Other Users?
Others avoiding work at the Monastery: (3)
As of 2015-10-05 00:55 GMT
Find Nodes?
    Voting Booth?

    Does Humor Belong in Programming?

    Results (106 votes), past polls