in reply to Re: Perl Style: About error messges opening files
in thread Perl Style: About error messges opening files
I've been writing some C lately, and I've started appreciating perror. Perhaps I should write a little module give similar functionality.
Hmm. A start would be to just tell those of us who have never heard of it a bit about it. :-) (Like me.)
And I usually leave the die line numbering enabled in my scripts. Most of the time my scripts are running on cron jobs in the background and when files arent there its usually a serious matter and I want to be able to track it back from the line it died from. Since the error messages get logged automatically it doesnt much bother folks. When its user displayed ill often do something like
die "File '$foo' doesnt seem to exist!\n" unless -e $foo; open my $foo_fh,"<"',$foo or die "<$!:$foo";
So that the common case errors are trapped specifically and the general case stuff that probably indicate more serious things are trapped by the open.
First they ignore you, then they laugh at you, then they fight you, then you win.
-- Gandhi
|
|---|
| Replies are listed 'Best First'. | |
|---|---|
|
Re: Perl Style: About error messges opening files
by Abigail-II (Bishop) on Apr 27, 2004 at 11:37 UTC | |
by demerphq (Chancellor) on Apr 27, 2004 at 11:45 UTC | |
by Abigail-II (Bishop) on Apr 27, 2004 at 11:53 UTC | |
by demerphq (Chancellor) on Apr 27, 2004 at 12:06 UTC | |
by Abigail-II (Bishop) on Apr 27, 2004 at 12:16 UTC | |
by flyingmoose (Priest) on Apr 27, 2004 at 14:17 UTC | |
|