in reply to How do I check all the variables, subroutines etc in a Perl Module?

Lexical variables are not accessible (and may not even exist) outside their scope. Package variables are stored in a symbol table. The symbol table for module (package) is a hash. The keys are the names you seek. The values are references to typeglobs. It is necessary to dereference the typeglob to find out what the name is used for. The details are beyond my experience. The book "Programming Perl" has a lengthy section name "Symbol Tables". It appears to be what you need.
Bill
  • Comment on Re: How do I check all the variables, subroutines etc in a Perl Module?

Replies are listed 'Best First'.
Re^2: How do I check all the variables, subroutines etc in a Perl Module?
by LanX (Saint) on Aug 31, 2020 at 07:55 UTC
    > (and may not even exist)

    For clarification:

    As soon as a sub is compiled, it's lexical vars will "exist". They'll just be undefined outside their scope.

    DB<23> sub foo { my $bar =42 } DB<24> use PadWalker qw/peek_sub/; DB<25> x peek_sub(\&foo) 0 HASH(0x31ffa38) '$bar' => SCALAR(0x31ff828) -> undef DB<26>

    Peeking into file-scoped lexicals might be harder tho.

    Cheers Rolf
    (addicted to the Perl Programming Language :)
    Wikisyntax for the Monastery