Stuff with the Perl Foundation. A couple of patches in the Perl core. A few CPAN modules. That about sums it up.
I get tired of trying to remember all of the modules necessary to get information about subroutines, so I've released Sub::Information. This aggregates those modules under one roof and provides a clean interface. No modules are loaded until they're actually needed, thus keeping it fairly lean.
use Sub::Information;
my $info = inspect(\&code);
print $info->name;
print $info->package;
print $info->code;
print $info->address;
my $variables = $info->variables;
while ( my ($var, $value) = each %$variables ) {
print "$var = $value\n";
}
Comments, requests, and patches welcome. Read the docs for caveats and other features.
looks useful (Score:1)
This looks like a helpful debugging tool.
Dunno... (Score:1)
This is lots of introspection against perl and that's a moving target.
Re: (Score:2)
Yes, this module might be a bad idea, but I can never remember all of the other modules when I need them and I sling subroutines around enough that I need them. I find a lot of the code that I like or use are things that Perl 6 will give me for free. It's a frustrating wait.
Re: (Score:1)
Fair enough.
"Information" (Score:2, Insightful)
Of course, I wrote Class::Inspector and Module::Inspector, so there's some element of bias there
Re: (Score:1)
I agree, that’s a much better name. “Sub::Information” tells me nothing.
Thanks! (Score:2)
Thanks for the module - keep up the good work.