subroutine exists

G

George Mpouras

I have to check if an external package have a method or not (windows ,
linux)
 
R

Rainer Weikusat

George Mpouras said:
I have to check if an external package have a method or not (windows
, linux)

That a symbol table entry pointing at a code reference exists at the
moment doesn't necessarily mean it will still exist by the time it is
supposed to be used and vice-versa. In particular, this check won't
find anything an AUTOLOAD sub will either create or emulate.
 
G

George Mpouras

correct. It is a little bit more complicated. I know that my methods exists,
but they should not try to call something that do not exist, autoload
automation does not help a alot

Ο "Rainer Weikusat" έγÏαψε στο μήνυμα

George Mpouras said:
I have to check if an external package have a method or not (windows
, linux)

That a symbol table entry pointing at a code reference exists at the
moment doesn't necessarily mean it will still exist by the time it is
supposed to be used and vice-versa. In particular, this check won't
find anything an AUTOLOAD sub will either create or emulate.
 
G

George Mpouras

Some::package->can("some_method") is good. The side effect is that executes
the method (if exists) when you might only want to check
 
W

Wolf Behrenhoff

Am 28.03.2012 10:19, schrieb George Mpouras:
Some::package->can("some_method") is good. The side effect is that executes
the method (if exists) when you might only want to check

I don't observe such a side effect. It doesn't execute the function.

from perltoot:
The can() method, called against that object or class, reports back
whether its string argument is a callable method name in that class. In
fact, it gives you back a function reference to that method:

- Wolf
 

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Members online

No members online now.

Forum statistics

Threads
473,756
Messages
2,569,535
Members
45,008
Latest member
obedient dusk

Latest Threads

Top