leocharre has asked for the wisdom of the Perl Monks concerning the following question:
Working on a largish project, I have a ton of info to STDERR for watching what's up while the program is running.
I would have some errors and then it was tough to find them back in the code- I had a mountain of info on my error log. (using tail -f has been glorious)
For example, I know my sub will need scalar $a to hold a digit, if it doesn't- then I would normally output an error to STDERR, I felt that die was more holy, only for things that the system or perl would recognize as a real 'you are deadw, monkey' error.
lately, I realized that I should use die() a lot..?
1) Does this seem like it would help debugging, use die *whenever* something happens that should not happen? Is this a no brainer? What do other people do?
2) I've heard here and there that subs and scripts should ideally output nothing unless there's an error, is there any controversy to this amongst more experiences coders? Or is this basic mattured wisdom?
|
|---|
| Replies are listed 'Best First'. | |
|---|---|
|
Re: when to use die, questions about program feedback to the coder
by xdg (Monsignor) on Mar 09, 2006 at 16:39 UTC | |
|
Re: when to use die, questions about program feedback to the coder
by izut (Chaplain) on Mar 09, 2006 at 16:39 UTC | |
|
Re: when to use die, questions about program feedback to the coder
by davido (Cardinal) on Mar 09, 2006 at 18:29 UTC | |
|
Re: when to use die, questions about program feedback to the coder
by cbrandtbuffalo (Deacon) on Mar 09, 2006 at 17:55 UTC | |
|
Re: when to use die, questions about program feedback to the coder
by adrianh (Chancellor) on Mar 10, 2006 at 11:20 UTC |