I released an alpha version of Devel::file with the intention of seeking monk preferences for the defaults. The defaults are particularly important for this module because changing them is awkward.

There's detailed documentation on the link above but the basic idea of the module is to install signal handlers that print the source code around lines giving rise to exceptions or warnings. It can be used in the command-line with -d:file although I'd like it to be safe to leave in your PERL5OPT while developing.

I asked about die/warn signal handler best practice questions already, interacting with other handlers is still a tricky business. The alpha version tries to play well with others but I'm swinging towards refusing to install if there's already another custom handler. Thoughts?

Other questions that I'm pondering are:

Should warnings be intercepted?
Should user exceptions such as croak be intercepted?
What about stack dumps? (Note that the __DIE__ handler is called just before the program ending, so shouldn't interfere with exception handling)
How many lines of context should be shown?
Should the source be appended to all errors, or inserted after each?
I received a suggestion to only show context for the first syntax error as it's often the source of later problems, agree?
Currently, I use the source available from the debugger when -d is used and fallback to using IO::All otherwise. Is it worth trying to support the two, even though there will inevitably be differences?

Other suggestions and tips welcome.

Notes on the name

-d:file was a difficult choice, the other contenters included:
-d:brief -d:flower -d:mote -d:spair -d:vic +e -d:ceased -d:form -d:notation -d:spise -d:vil -d:code -d:fuse -d:nouement -d:spot -d:voi +d -d:cry -d:grade -d:parts -d:tail -d:vot +e -d:duce -d:light -d:press -d:ter -d:fault -d:lineate -d:range -d:test -d:feat -d:mean -d:ride -d:velope -d:fect -d:mented -d:sist -d:viant

Brad


In reply to Designing Defaults for Devel::file by bsb

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.