And in the example you gave, a die after failure of a system call, I would look at the program to solve the problem.

It usually doesn't take long to verify that the program had no way of succeeding in that particular operation. The question then becomes why it thought it might. Which means that I need to figure out what it was doing, and the line number is useful. In fact it is so useful that I prefer to use Carp's confess to get even more context at my finger tips.

You lost me here. My programs don't continue after a die() (assuming it's outside of an eval), so I never have this "why did I think it would succeed" problem to solve.
Apparently I did lose you. :-(

Yes, programs that die don't tend to carry on. But programs don't (or shouldn't) randomly do fatal things for no apparent reason.

Suppose for instance that a program tried to open a file that wasn't there, and then dies. It doesn't take long for me to figure out that the file isn't there, and it should have died. Fine. Now what do I do about it? Perhaps the file just needs to be replaced. Perhaps the programmer didn't realize that said file won't be there at certain times, and there should be an existence check and that step should be skipped. Perhaps the program needs to wait for the file to be replaced before progressing. Perhaps the program should have terminated as it did.

Lots of possibilities, and for a lot of them that line number will prove useful to me.


In reply to Re: Re: How to get die() to stop printing a line number? by tilly
in thread How to get die() to stop printing a line number? by Anonymous Monk

Title:
Use:  <p> text here (a paragraph) </p>
and:  <code> code here </code>
to format your post, it's "PerlMonks-approved HTML":



  • Posts are HTML formatted. Put <p> </p> tags around your paragraphs. Put <code> </code> tags around your code and data!
  • Titles consisting of a single word are discouraged, and in most cases are disallowed outright.
  • Read Where should I post X? if you're not absolutely sure you're posting in the right place.
  • Please read these before you post! —
  • Posts may use any of the Perl Monks Approved HTML tags:
    a, abbr, b, big, blockquote, br, caption, center, col, colgroup, dd, del, details, div, dl, dt, em, font, h1, h2, h3, h4, h5, h6, hr, i, ins, li, ol, p, pre, readmore, small, span, spoiler, strike, strong, sub, summary, sup, table, tbody, td, tfoot, th, thead, tr, tt, u, ul, wbr
  • You may need to use entities for some characters, as follows. (Exception: Within code tags, you can put the characters literally.)
            For:     Use:
    & &amp;
    < &lt;
    > &gt;
    [ &#91;
    ] &#93;
  • Link using PerlMonks shortcuts! What shortcuts can I use for linking?
  • See Writeup Formatting Tips and other pages linked from there for more info.