Beefy Boxes and Bandwidth Generously Provided by pair Networks
Think about Loose Coupling
 
PerlMonks  

Re: test for subroutine existence

by ehdonhon (Curate)
on Aug 12, 2002 at 17:00 UTC ( [id://189547]=note: print w/replies, xml ) Need Help??


in reply to test for subroutine existence

As long as you are using a simple module with no inheritance, you could rely on can to do this:

if ( __PACKAGE__->can( 'sub_to_test' ) ) { ... }

Log In?
Username:
Password:

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

How do I use this?Last hourOther CB clients
Other Users?
Others musing on the Monastery: (9)
As of 2025-06-24 09:52 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.