Beefy Boxes and Bandwidth Generously Provided by pair Networks
Perl-Sensitive Sunglasses
 
PerlMonks  

Re^2: Detect undefined subroutines

by ihb (Deacon)
on Sep 18, 2004 at 16:51 UTC ( [id://392005]=note: print w/replies, xml ) Need Help??


in reply to Re: Detect undefined subroutines
in thread Detect undefined subroutines

You could use

sub foo { ... } *foo->(...);
to receive compile-time warnings, assuming you don't use any other global datatype called foo (and doesn't try to call the same undefined subroutine twice).

Update: boldened "warnings" and added parenthesis.

ihb

Read argumentation in its context!

Replies are listed 'Best First'.
Re^3: Detect undefined subroutines
by tilly (Archbishop) on Sep 18, 2004 at 17:51 UTC
    Interesting idea, but it doesn't seem to work.
    tilly@(none):~$ perl -ce 'use strict; *foo->()' -e syntax OK tilly@(none):~$ perl -e 'use strict; *foo->()' Undefined subroutine &main::foo called at -e line 1.
    Tested with Perl 5.8.4.

    UPDATE I see, my oversight.

      You need to turn on warning to see them...

      $ perl -Mstrict -cwe '*foo->()' Name "main::foo" used only once: possible typo at -e line 1. -e syntax OK $ perl -Mstrict -we '*foo->()' Name "main::foo" used only once: possible typo at -e line 1. Undefined subroutine &main::foo called at -e line 1.

      ihb

      Read argumentation in its context!

Log In?
Username:
Password:

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

How do I use this?Last hourOther CB clients
Other Users?
Others taking refuge in the Monastery: (3)
As of 2024-04-25 09:39 GMT
Sections?
Information?
Find Nodes?
Leftovers?
    Voting Booth?

    No recent polls found