Slash Boxes
NOTE: use Perl; is on undef hiatus. You can read content, but you can't post it. More info will be forthcoming forthcomingly.

All the Perl that's Practical to Extract and Report

use Perl Log In

Log In

[ Create a new account ]

Ovid (2709)

  (email not shown publicly)
AOL IM: ovidperl (Add Buddy, Send Message)

Stuff with the Perl Foundation. A couple of patches in the Perl core. A few CPAN modules. That about sums it up.

Journal of Ovid (2709)

Wednesday May 02, 2007
03:57 AM

Sub::Information 0.01

[ #33177 ]

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.

The Fine Print: The following comments are owned by whoever posted them. We are not responsible for them in any way.
More | Login | Reply
Loading... please wait.
  • It looks useful-- thanks! Usually I just grep around if I want to find the package that a subroutine came from.

    This looks like a helpful debugging tool.
  • I'm dubious. I suspect this just means your module is another part of the debugging toolchain that can go out of sync with perl or other parts of the toolchain that it depends on.

    This is lots of introspection against perl and that's a moving target.
    • 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.

  • Shouldn't that be Sub::Inspector?

    Of course, I wrote Class::Inspector and Module::Inspector, so there's some element of bias there :)
  • Thanks for the module - keep up the good work.