Beefy Boxes and Bandwidth Generously Provided by pair Networks
Perl: the Markov chain saw
 
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 drinking their drinks and smoking their pipes about the Monastery: (6)
As of 2024-07-17 12:41 GMT
Sections?
Information?
Find Nodes?
Leftovers?
    Voting Booth?

    No recent polls found

    Notices?
    erzuuli‥ 🛈The London Perl and Raku Workshop takes place on 26th Oct 2024. If your company depends on Perl, please consider sponsoring and/or attending.