The Perl Toolchain Summit needs more sponsors. If your company depends on Perl, please support this very important event.

NAME

Module::Data - Introspect context information about modules in @INC

VERSION

version 0.001

SYNOPSIS

    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.

METHODS

package

Returns the package the Module::Data instance was created for.

        my $package = $md->package 

path

A Path::Class::File with the absolute path to the found module.

        my $path = $md->path;

root

Returns the base directory of the tree the module was found at. ( Probably from @INC );

        my $root = $md->root

version

        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. 

AUTHOR

Kent Fredric <kentnl@cpan.org>

COPYRIGHT AND LICENSE

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.