in reply to Perl's Reflective and Introspective Capabilities?

You should take a look at Schwern's Module::Info module.

Here's the synopsis for the most recent version (0.12). Does anything here look interesting to you?

SYNOPSIS
         use Module::Info;

         my $mod = Module::Info->new_from_file('Some/Module.pm');
         my $mod = Module::Info->new_from_module('Some::Module');
         my $mod = Module::Info->new_from_loaded('Some::Module');

         my @mods = Module::Info->all_installed('Some::Module');

         my $name    = $mod->name;
         my $version = $mod->version;
         my $dir     = $mod->inc_dir;
         my $file    = $mod->file;
         my $is_core = $mod->is_core;

         # Only available in perl 5.6.1 and up.
         # These do compile the module.
         my @packages = $mod->packages_inside;
         my @used     = $mod->modules_used;
         my @subs     = $mod->subroutines;
         my @isa      = $mod->superclasses;
         my @calls    = $mod->subroutines_called;

         # Check for constructs which make perl hard to predict.
         my @methods   = $mod->dynamic_method_calls;
         my @lines     = $mod->eval_string;    *UNIMPLEMENTED*
         my @lines     = $mod->gotos;          *UNIMPLEMENTED*
         my @controls  = $mod->exit_via_loop_control;      *UNIMPLEMENTED*
         my @unpredictables = $mod->has_unpredictables;    *UNIMPLEMENTED*

Cheers,
Richard

  • Comment on Re: Perl's Reflective and Introspective Capabilities?