I'm now readying my first major (more than a couple dozen lines of code) module to CPAN. I used Log4Perl and a Log4Perl wrapper with some convenience methods I wrote to make it easy to debug and trace the execution of my code while writing it.

What's the best practice as far as leaving this code in the official CPAN release? On the one hand, I don't want to clutter up the code and require users to install Log4Perl and my wrapper for log commands that will be turned off by default for them anyway. On the other hand, I'd rather avoid having to adding/removing the necessary use and various log commands when it comes time to add a new feature or debug existing code.

I've never seen a CPAN module that was littered with debug statements so I'm thinking I should just pull out the Log4perl module and all related statements.

But maybe there is some way I can get the best of both worlds? Maybe just leave the logging code in there an comment them out?

$PM = "Perl Monk's";
$MCF = "Most Clueless Friar Abbot Bishop Pontiff Deacon Curate Priest";
$nysus = $PM . ' ' . $MCF;
Click here if you love Perl Monks


In reply to Leave log4perl debug code in cpan module? by nysus

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.