Beefy Boxes and Bandwidth Generously Provided by pair Networks
Clear questions and runnable code
get the best and fastest answer
 
PerlMonks  

Re: Possible to catch undefined sub at "compile" time? (two ways)

by tye (Sage)
on Oct 10, 2007 at 14:26 UTC ( [id://643967]=note: print w/replies, xml ) Need Help??


in reply to Possible to catch undefined sub at "compile" time?

use warnings; use strict; sub monk {} sub go { mink 123; }

Done.

It also wouldn't be hard to write a module to scan the symbol table for references to undefined subroutines after the main script finished compiling and right before it starts running. I believe diotalevi(?) already wrote a module to report references to undefined subroutines.

- tye        

Replies are listed 'Best First'.
Re^2: Possible to catch undefined sub at "compile" time? (two ways)
by diotalevi (Canon) on Oct 10, 2007 at 18:09 UTC

    I didn't write B::Lint. It comes with your perl.

    ⠤⠤ ⠙⠊⠕⠞⠁⠇⠑⠧⠊

      I guess diotalevi's solution is what I was looking for:

      > perl -MO=Lint -c mink.pl Nonexistant subroutine 'mink' called at mink.pl line 4 mink.pl syntax OK

      It's a pity that it doesn't work on Windows to add '-MO=Lint' in the shebang line.

      Thanks everyone for your help and/or entertaining suggestions.

Log In?
Username:
Password:

What's my password?
Create A New User
Domain Nodelet?
Node Status?
node history
Node Type: note [id://643967]
help
Chatterbox?
and the web crawler heard nothing...

How do I use this?Last hourOther CB clients
Other Users?
Others musing on the Monastery: (3)
As of 2024-04-23 23:32 GMT
Sections?
Information?
Find Nodes?
Leftovers?
    Voting Booth?

    No recent polls found