http://qs1969.pair.com?node_id=391789


in reply to Detect undefined subroutines

There doesn't appear to be any way to do what you want. The trouble being that Perl's subs are dynamic, so it is completely fair to have a sub that is created on the fly, and only exists when the program is running.

This is, after all, what happens when you import a module.

A quick browse of CPAN didn't show up any module that would do run-time checks for functions to exist, so it sounds like you have 'an opportunity, rather than a problem'.

___________________
Jeremy
I didn't believe in evil until I dated it.

Replies are listed 'Best First'.
Re^2: Detect undefined subroutines
by adamk (Chaplain) on Sep 18, 2004 at 14:14 UTC
    That must have been a quick browse :)

    Class::Inspector has a bunch of stuff you could use to check for various things.

    If your classes don't do any run-time function munging, Test::ClassAPI will let you check for the existance of methods throughout an entire API, and will warn you if it finds extras.
      It was indeed a quick browse, combined with an old memory of looking quite hard for this. This time I went through, paying particular attention to the Sub:: hierachy, hence missing them tucked away in Class::. I've written objects before in perl, but I don't think of methods and functions(sub{}s), classes and namespaces as being interchangable, which is kind of implied with your naming scheme.

      I do realise that they more-or-less are, but I learned on GWBasic first, so if I can "call" it, I think "It's a sub" :)

      Anyway, cool modules and I'm gonna go take the back off them and see what makes them tick. But I'll do it later, I'm too tired now.

      ___________________
      Jeremy
      I didn't believe in evil until I dated it.