in reply to Misspelled subroutine name -- no way to catch it at compile time? C'mon.

> My program crashed at runtime. I don't want to write a test that does a "can" on every darned subroutine I call in my program.

Than use AUTOLOAD to catch the call before crashing.

You haven't told us which behavior you expect, so like this you're free to implement it yourself...

Update

To catch a typo at compile time, drop the parens

See Re^3: How to identify incorrect subroutine calls in a perl program

Generally it's better to import the sub too, instead of a full qualified call.

Cheers Rolf
(addicted to the Perl Programming Language :)
see Wikisyntax for the Monastery

  • Comment on Re: Misspelled subroutine name -- no way to catch it at compile time? C'mon.

Replies are listed 'Best First'.
Re^2: Misspelled subroutine name -- no way to catch it at compile time? C'mon.
by ikegami (Patriarch) on Dec 16, 2024 at 20:19 UTC

    For best results, use use v5.28;/no feature qw( indirect );/no indirect; along with omitting parens. If you don't, omitting parens won't always detect the problem at compile-time, and new weird issues could be introduced.