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? | [reply] [d/l] [select] |
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..
Malk.
| [reply] |
(Ovid) Re: How do you wanna die() ?
by Ovid (Cardinal) on Mar 06, 2001 at 14:37 UTC
|
| [reply] |
Re: How do you wanna die() ?
by extremely (Priest) on Mar 06, 2001 at 10:08 UTC
|
| [reply] [d/l] |
|
| [reply] [d/l] |
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. | [reply] |
(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! $!";
--Chris
e-mail jcwren
| [reply] [d/l] |
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.
____________________
Jeremy
I didn't believe in evil until I dated it. | [reply] |
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. | [reply] [d/l] [select] |
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: $!";
.
.
.
| [reply] [d/l] |
Re: How do you wanna die() ?
by McD (Chaplain) on Mar 07, 2001 at 07:07 UTC
|
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. :-)
Peace,
-McD
| [reply] [d/l] |
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: $!";
or
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 $!"
magnus | [reply] [d/l] [select] |
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... thunk..life was too good: $!";
die "roadkill..cause of death: $!";
| [reply] [d/l] [select] |
Re: How do you wanna die() ?
by pmas (Hermit) on May 30, 2001 at 21:46 UTC
|
(1) Fatal error detected:
C-Cancel, R-Retry, B-Boot New Universe?
(2) Invalid character found between 'chair' and 'keyboard'.
| [reply] [d/l] |
|
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
| [reply] |
Re: How do you wanna die() ?
by grinder (Bishop) on Mar 07, 2001 at 14:07 UTC
|
| [reply] [d/l] [select] |
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";
| [reply] [d/l] |
|
| [reply] |
(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):$!";
___crazyinsomniac_______________________________________
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;"
| [reply] [d/l] |
|
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;
| [reply] |
Re: How do you wanna die() ?
by MadraghRua (Vicar) on Mar 08, 2001 at 04:52 UTC
|
| [reply] |