|
NAMEModule::Info - Information about Perl modulesSYNOPSISuse 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* # set/get Module::Info options $self->die_on_compilation_error(1); my $die_on_error = $mod->die_on_compilation_error; $self->safe(1); my $safe = $mod->safe; DESCRIPTIONModule::Info gives you information about Perl modules without actually loading the module. It actually isn't specific to modules and should work on any perl code.METHODSConstructorsThere are a few ways to specify which module you want information for. They all return Module::Info objects.
Information without loadingThe following methods get their information without actually compiling the module.
Information that requires loading.WARNING! From here down reliability drops rapidly!The following methods get their information by compiling the module and examining the opcode tree. The module will be compiled in a separate process so as not to disturb the current program. They will only work on 5.6.1 and up and requires the B::Utils module.
Information about Unpredictable ConstructsUnpredictable constructs are things that make a Perl program hard to predict what its going to do without actually running it. There's nothing wrong with these constructs, but its nice to know where they are when maintaining a piece of code.
OptionsThe following methods get/set specific option values for the Module::Info object.
AUTHORMichael G Schwern <schwern@pobox.com> with code from ExtUtils::MM_Unix, Module::InstalledVersion and lots of cargo-culting from B::Deparse.Mattia Barbon <mbarbon@cpan.org> is the current maintainer. LICENSEThis program is free software; you can redistribute it and/or modify it under the same terms as Perl itself.THANKSMany thanks to Simon Cozens and Robin Houston for letting me chew their ears about B.CAVEATSCode refs in @INC are currently ignored. If this bothers you submit a patch.superclasses() is cheating and just loading the module in a separate process and looking at @ISA. I don't think its worth the trouble to go through and parse the opcode tree as it still requires loading the module and running all the BEGIN blocks. Patches welcome. I originally was going to call superclasses() isa() but then I remembered that would be bad. All the methods that require loading are really inefficient as they're not caching anything. I'll worry about efficiency later.
Visit the GSP FreeBSD Man Page Interface. |