Beefy Boxes and Bandwidth Generously Provided by pair Networks
Think about Loose Coupling

How do you wanna die() ?

by zdog (Priest)
on Mar 06, 2001 at 07:11 UTC ( #62425=perlmeditation: print w/replies, xml ) Need Help??

I've been wondering this for a while, and haven't gotten around to posting it, but anyway, I was wondering if anyone had some funny, creative, or just put-a-smile-on-your-face die () messages that they have used before or just came up with as they were reading this and wanted to possibly share them with the rest of us? This includes warn () or any of the messages you would use with the Carp functions.


Zenon Zabinski | zdog |

Replies are listed 'Best First'.
Re: How do you wanna die() ?
by azatoth (Curate) on Mar 06, 2001 at 18:14 UTC
    die "Nope : $!\n";
    Has always been a favourite of mine. I guess it makes me feel like Perl is a language that is easy to get hooked on, but could take a lifetime to master...

    Writing a program and getting it to work exactly how you meant it to is one of the best feelings around, one especially magnified to a newbie programmer. Spending a few hours plugging away at something, running it and getting
    Nope : No such file or directory
    is a tactful way of letting me know that Perl is the boss, and I am the student, as always.

    Azatoth a.k.a Captain Whiplash

    Get YOUR PerlMonks Stagename here!
    Want to speak like a Londoner?
Re: How do you wanna die() ?
by Malkavian (Friar) on Mar 06, 2001 at 18:32 UTC
    For some perverse reason, I like the semi-technical messages. Firm favourites of mine for incorrect data are:
    "User integrity error. Readjust thinking and retry entry to remedy $!\n"
    "While checking data, sanity check was failed. Cannot commit entry. Commit user and retry.\n"

    In sections of code I know work for me under all conditions the code should ever operate in that I know of, I have such entries as:
    "Fatal error: $! Replace user and retry.\n"
    I go on the theory that anyone using my code where I am has a reasonable sense of humour. Otherwise they'd have gone insane a while back. Those that went insane due to lack of humour would find the strangest of things funny anyway.
    So, a little bit of levity when things go belly up is a good thing. :)

    Just my tuppence worth..

(Ovid) Re: How do you wanna die() ?
by Ovid (Cardinal) on Mar 06, 2001 at 14:37 UTC
Re (tilly) 1: How do you wanna die() ?
by tilly (Archbishop) on Mar 06, 2001 at 10:58 UTC
    You should definitely look up Coy, and you may find Mortal Kombat! to your taste as well.
Re: How do you wanna die() ?
by extremely (Priest) on Mar 06, 2001 at 10:08 UTC
    I've used  or die "Arrrrrrgh, $!"; quite a bit, along with a million variations. Also, "*screeaaaatch* $!" works pretty good too.

    $you = new YOU;
    honk() if $you->love(perl)

      SQUEAK? --Death of Rats

      For a while I used die "dryrot" for failed assertions.

(jcwren) Re: How do you wanna die() ?
by jcwren (Prior) on Mar 06, 2001 at 18:56 UTC

    On of the biggest advantages of putting a common header on die() and warn() messages is for grepping logs and such, especially if they run from cron, or invoked as external programs from CGI.

    To that end, I use die "Eeeek! $!";


    e-mail jcwren
Re: How do you wanna die() ?
by jepri (Parson) on Mar 06, 2001 at 17:40 UTC
    In my more down moments I have used "If you didn't suck so much, $! would never have occured"

    On a slightly related note I was once programming a javascript form validator (compulsory fields) that used to pop up with messages like "You didn't enter your name! What's wrong with you, can't you remember your name and phone number at the same time?" and variations upon that.

    I didn't believe in evil until I dated it.

Re: How do you wanna die() ?
by yakko (Friar) on Mar 06, 2001 at 21:47 UTC
    When feeling silly, I use die lines like these:
    die "$0 casts itself into the Gorge of Eternal Peril: $!"; die "$0 on fire: $!"; # lp1 on fire die "mailx -s 'Idiot coding perl' merlyn < /dev/null : $!";
    Of course, when all's debugged, I simply use bland ones:
    die "open(timehole): $!\n";

    Me spell chucker work grate. Need grandma chicken.

Re: How do you wanna die() ?
by BrotherAde (Pilgrim) on Mar 06, 2001 at 18:05 UTC
    I usually describe the sort of death my code dies:
    die "a slow, suffocating death: $!"; die "quickly and painlessly: $!"; die "horribly: $!"; . . .
Re: How do you wanna die() ?
by McD (Chaplain) on Mar 07, 2001 at 07:07 UTC
    These are from my largest (and favorite) Perl application to date.

    While opening a file that was there when I readdir()'d a second ago:

    open (FILE, $file) or die "HEY! Where'd $file go? $!";
    I laughed like hell the day I saw it in a log.

    A little off topic, but another favorite log message - this app communicates with a child process via an open2() mechanism. If they get out of sync, bad things happen. I found they can get out of sync when the child is reporting back an error condition, so as a hack to guard against it, I just kill the child, causing a new one to be spawned when I need it next. The logged message was:

    Killing my child for reporting an error - call DYFS
    (DYFS - Department of Youth and Family Services)

    A few people have noticed that one in the logs. :-)


Re: How do you wanna die() ?
by magnus (Pilgrim) on Mar 06, 2001 at 20:11 UTC
    for me it depends on who's gonna see it... if the person reading it is not really gonna have any idea of what the error means and ask someone else for help anyway, i use:

     die "Whoops! Something really strange just occured: $!";


     die "Uh-oh... Something went *SNAP* inside the computer: $!";

    however, when i know that someone who will have an idea of what's up will be reading, i use:

     die "After the pleading and squealing, this script died like the dog is was because $!"

Re: How do you wanna die() ?
by LD2 (Curate) on Mar 06, 2001 at 21:04 UTC
    I've used this with programs that I was messing around with .. so I was the only one to view 'em.

    die "aCk.. Splat... was too good: $!";
     die "roadkill..cause of death: $!";

Re: How do you wanna die() ?
by pmas (Hermit) on May 30, 2001 at 21:46 UTC
    My favorites:
    (1) Fatal error detected: C-Cancel, R-Retry, B-Boot New Universe? (2) Invalid character found between 'chair' and 'keyboard'.
      i want to get shot in the head with a sniper rifle by Russian mafia and to be burned and burried in the middle of the pacific ocean
Re: How do you wanna die() ?
by grinder (Bishop) on Mar 07, 2001 at 14:07 UTC

    How depressing. I just grepped as much perl code as I could find and it's all boringly technical.

    $< and die "Not running as root.\n";


    my $gid  = getgrnam $group or die "$group not in /etc/group\n";

    but I did find

    -d $base or die "$base directory does not exist (time to panic)\n"; grinder
Re: How do you wanna die() ?
by indapa (Monk) on Mar 08, 2001 at 04:27 UTC
    Taken from the Learning Perl book, I found this amusing:
    die "you gravy-sucking pigs";
(crazyinsomniac) Re: How do you wanna die() ?
by crazyinsomniac (Prior) on Mar 07, 2001 at 17:42 UTC
    On my knees baby.

    With you on your knees baby.

    Howling at the moon baby.

    Screaming out your name baby.
    (**note: baby denotes a femme, preferably very curvy with red hair)
    open(FH,"<$file) or die "crap($file):$!";

    Disclaimer: Don't blame. It came from inside the void

    perl -e "$q=$_;map({chr unpack qq;H*;,$_}split(q;;,q*H*));print;$q/$q;"

      are you sure?? before, or after it's done???

      in my case:
      I believe a broken parachute would do the job just FINE!!!
      well, i mean "Damit!! ... PUF!!!"

      #!/jpsama/bin/perl -w
      $tks = `mount`;
      $jpsama = $! if $!;
      print $jpsama;
Re: How do you wanna die() ?
by MadraghRua (Vicar) on Mar 08, 2001 at 04:52 UTC
    Not by me, but a developer with initials ABC used to echo error messages:
    call ABC_error: $!
    Users most frequent comment was what exactly should they call ABC - we gathered quite an amusing little list of suggestions...

    yet another biologist hacking perl....

Log In?

What's my password?
Create A New User
Domain Nodelet?
Node Status?
node history
Node Type: perlmeditation [id://62425]
Approved by root
and the web crawler heard nothing...

How do I use this? | Other CB clients
Other Users?
Others making s'mores by the fire in the courtyard of the Monastery: (5)
As of 2022-08-10 20:20 GMT
Find Nodes?
    Voting Booth?

    No recent polls found