in reply to Re: Can a Perl module "inspect" itself and provide details about methods and parameters?
in thread Can a Perl module "inspect" itself and provide details about methods and parameters?

Cool! Using a regex stolen from Class::Inspector:

CORE functions:

perl '-MData::Dumper()' -e '@_=sort grep {/\A[^\W\d]\w*\z/o} keys %{"$ +{CORE}::"};print Data::Dumper::Dumper\@_'
CORE + Cwd import:
perl '-MData::Dumper()' -MCwd -e '@_=sort grep {/\A[^\W\d]\w*\z/o} key +s %{"${CORE}::"};print Data::Dumper::Dumper\@_'
Everything:
perl '-MData::Dumper()' -e '@_=sort keys %{"${CORE}::"};print Data::Du +mper::Dumper\@_'
  • Comment on Re^2: Can a Perl module "inspect" itself and provide details about methods and parameters?
  • Select or Download Code

Replies are listed 'Best First'.
Re^3: Can a Perl module "inspect" itself and provide details about methods and parameters?
by LanX (Saint) on Sep 23, 2019 at 00:47 UTC
    > CORE functions:

    nope these are some plain named symbols in the %main:: STASH since your var $CORE is undef.

    Anyway you need to check the {CODE} slot of the glob-values to be sure that they hold a code-ref.

    DB<30> sub test { "bla" } DB<31> x map { \&$_ } grep {defined &$_ } values %:: 0 CODE(0x3477178) -> &main::test in (eval 40)[C:/Perl_524/lib/perl5db.pl:737]:2-2 1 CODE(0x3463838) -> &main::dumpvar in C:/Perl_524/lib/dumpvar.pl:474-501 2 CODE(0x3457a78) -> &main::dumpValue in C:/Perl_524/lib/dumpvar.pl:33-40 DB<32>

    dumpvar and dumpValue are internal debugger routines

    Cheers Rolf
    (addicted to the Perl Programming Language :)
    Wikisyntax for the Monastery FootballPerl is like chess, only without the dice