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

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...)

<GRUMP>

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.

Great.

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.

</GRUMP>


Mike

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

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!
  • 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?
    Username:
    Password:

    What's my password?
    Create A New User
    Chatterbox?
    and the web crawler heard nothing...

    How do I use this? | Other CB clients
    Other Users?
    Others avoiding work at the Monastery: (4)
    As of 2015-07-04 07:54 GMT
    Sections?
    Information?
    Find Nodes?
    Leftovers?
      Voting Booth?

      The top three priorities of my open tasks are (in descending order of likelihood to be worked on) ...









      Results (58 votes), past polls