It wasn't my post, but the reason is simple. The hook in question will make errors go to the browser in a fairly informative fashion. This aids development. But if someone is trying to attack your site, the debugging output will help them break in.

It is kind of like leaving a note saying where the key is hidden.

That said, the actual style given there of having lines of code you modify between development and production is not the way you should do it. Instead what you should do is have a very small module that has those lines. Install that module in your development environment. Then in your production environment have a different version of the module that doesn't do anything. That way you don't have to touch your code going from development to production, and nothing will mess up. Otherwise your development process will be constantly complicated by the need to track down things like those lines which have to be edited at the last moment before going live, lines which you could introduce errors on. This will be an ongoing source of work and problems.

Many here will recognize this as an example of an abstraction layer. Instead of writing in development hooks through your code, you write an abstraction layer for turning on the optional hooks. That abstraction layer will do the right thing for your evironment without your having to change a lot of source code going from one environment to another. The idea of solving problems with abstraction layers rather than scattered checks is a key one in good programming. I talk about it a bit at RE (tilly) 2: Handling cascading defaults (abstraction is great!) among other places.


In reply to Re (tilly) 1: Could you explain the importance of this line from your post? by tilly
in thread @ symbol in html output 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.