Module::Data - Introspect context information about modules in @INC
version 0.001
use Module::Data; my $d = Module::Data->new( 'Package::Stash' ); $d->path; # returns the path to where Package::Stash was found in @INC $d->root; # returns the root directory in @INC that 'Package::Stash' was found inside. # Convenient trick to discern if you're in a development environment my $d = Module::Data->new( 'Module::Im::Developing' ); if ( -e $d->root->parent->dir('share') ) { # Yep, this dir exists, so we're in a dev context. # because we know in the development context all modules are in lib/*/* # so if the modules are anywhere else, its not a dev context. # see File::ShareDir::ProjectDistDir for more. } # Helpful sugar. my $v = $d->version;
Presently all the guts are running of Perl INC{} magic, but work is in progress and this is just an early release for some base functionality.
Returns the package the Module::Data instance was created for.
Module::Data
my $package = $md->package
A Path::Class::File with the absolute path to the found module.
my $path = $md->path;
Returns the base directory of the tree the module was found at. ( Probably from @INC );
my $root = $md->root
my $v = $md->version; # really just shorthand convenience for $PACKAGE->VERSION # will be possibly extracted out without loading the module first in a future release.
Kent Fredric <kentnl@cpan.org>
This software is copyright (c) 2012 by Kent Fredric <kentnl@cpan.org>.
This is free software; you can redistribute it and/or modify it under the same terms as the Perl 5 programming language system itself.
To install Module::Data, copy and paste the appropriate command in to your terminal.
cpanm
cpanm Module::Data
CPAN shell
perl -MCPAN -e shell install Module::Data
For more information on module installation, please visit the detailed CPAN module installation guide.