One possible solution to this would be to create test scripts (e.g. using Test::More) for the module in question:
package foo; use warnings; use strict; sub monk { return 42; } sub go { return mink(123); } 1; __END__
use strict; use warnings; use Test::More tests => 3; use lib qw (.); BEGIN { use_ok('foo'); } # ------ monk ------ cmp_ok(foo::monk(), q{==}, 42, q{Expect monk to return 42}); # ------ go ------ cmp_ok(foo::go(), q{==}, 42, q{Expect go to return 42}); __END__
Running the test yields:
$ prove foo.t foo....ok 1/3Undefined subroutine &foo::mink called at foo.pm line 8. # Looks like you planned 3 tests but only ran 2. # Looks like your test died just after 2. foo....dubious Test returned status 255 (wstat 65280, 0xff00) DIED. FAILED test 3 Failed 1/3 tests, 66.67% okay Failed Test Stat Wstat Total Fail List of Failed ---------------------------------------------------------------------- +--------- foo.t 255 65280 3 2 3 Failed 1/1 test scripts. 1/3 subtests failed. Files=1, Tests=3, 1 wallclock secs ( 0.04 cusr + 0.00 csys = 0.04 C +PU) Failed 1/1 test programs. 1/3 subtests failed.
--
Andreas

In reply to Re: Possible to catch undefined sub at "compile" time? by andreas1234567
in thread Possible to catch undefined sub at "compile" time? 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.