Beefy Boxes and Bandwidth Generously Provided by pair Networks
more useful options
 
PerlMonks  

Re: Test for Subroutine Definition

by tadman (Prior)
on Aug 15, 2002 at 07:42 UTC ( [id://190330]=note: print w/replies, xml ) Need Help??


in reply to test for subroutine existence

Just my two cents:
sub foo { } foreach (qw[ foo bar ]) { print "$_? ",(defined(*$_{CODE})? "defined":"undef"), "\n"; }
Using this kind of test, you can check for other stuff, like GLOB, filehandles and such, which aren't easily prefixed with something like '$', '&', '%' or '@'.

Log In?
Username:
Password:

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

How do I use this?Last hourOther CB clients
Other Users?
Others having a coffee break in the Monastery: (3)
As of 2025-06-20 19:06 GMT
Sections?
Information?
Find Nodes?
Leftovers?
    Voting Booth?

    No recent polls found

    Notices?
    erzuuliAnonymous Monks are no longer allowed to use Super Search, due to an excessive use of this resource by robots.