The dir
command in Python 2.7.x lists all accessible 'symbols' from a module.
Is there an equivalent in Perl 5.x to list all accessible 'symbols' from a package?
For package h
,
package h;
our $r;
use Data::Dumper;
print Dumper \%h::;
say for sort keys %Foo::Bar::;
You can use
*Foo::Bar::sym{SCALAR}
*Foo::Bar::sym{ARRAY}
*Foo::Bar::sym{HASH}
etc
to see if the symbol has those a variable of the specified type associated with it.
You can do it all yourself by rummaging around in the package's symbol table. But Devel::Symdump makes it all a lot easier.
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With