in reply to Re^3: list all subs in a package
in thread list all subs in a package

That's interesting. How would I detect a non-constant sub with length zero prototype? Or, more generally, how would I distinguish between a true constant function and a function like baz?

Replies are listed 'Best First'.
Re^5: list all subs in a package
by ikegami (Patriarch) on Jan 02, 2009 at 10:26 UTC

    I don't think it's possible without some XS code, but the information appears to be present.

    >perl -MDevel::Peek -e"sub X() { time } Dump \&X" SV = PVCV(0x182647c) at 0x1831628 FLAGS = (POK,pPOK) >perl -MDevel::Peek -e"sub X() { 1 } Dump \&X" SV = PVCV(0x1833acc) at 0x1831688 FLAGS = (POK,pPOK,CONST)

    (Irrelevant bits filtered out)