Beefy Boxes and Bandwidth Generously Provided by pair Networks
Perl Monk, Perl Meditation

Comment on

( #3333=superdoc: print w/replies, xml ) Need Help??
(This might be more appropriate as a Meditation, or a Perl Gripe, if this site had such a section. But maybe someone has some Perl Wisdom to offer that could help me work around this issue...)


I ran into an annoying problem today, again.

Whenever I code, I always use strict, -w, and code defensively. I try to test as much as I can, and I always make sure at a minimum that code is -c clean after any editing pass.


But I still get bit, on occasion, by typos in function names.

The only way you'll find out that there's a typo in

sub handleNewYear { # do something really useful } # ... lotsa logic... if($mday==1 && $month==1) { handelNewYear(); }
is at run time, when the app croaks because "Undefined subrouting &main::handelNewYear called at...", and only if you happen to excercise that branch of your code.

If it happens to be your new year's day special case handling logic, I guess you'll get beeped out of the party :)

I realize there's no way -w could catch this; there could be autoloads providing the subroutine, or it could have been dynamically generated at runtime in an eval, or something.

But it would be nice if there was a way to catch such cases, without having to write a test suite that exercises every code branch, which isn't always (or even usually) possible.



In reply to When -w and use strict aren't enough... by RMGir

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, 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, 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.
  • Log In?

    What's my password?
    Create A New User
    and all is quiet...

    How do I use this? | Other CB clients
    Other Users?
    Others contemplating the Monastery: (6)
    As of 2018-03-18 00:39 GMT
    Find Nodes?
      Voting Booth?
      When I think of a mole I think of:

      Results (228 votes). Check out past polls.