NAME

Module::Path - Get the path to a locally installed module

VERSION

version 0.13

RELEASE DATE

2014-04-25

SYNOPSIS

use Module::Path 'module_path', 'pod_path';

$path = module_path('Test::More');
if (defined($path)) {
  print "Test::More found at $path\n";
} else {
  print "Danger Will Robinson!\n";
}

# can also find module in the form that 'require' uses
$path = module_path();

# find all found modules, as well as .pmc and .pod files
@path = module_path('Foo::Bar', {all=>1, find_pmc=>1, find_pod=>1});

# just an alias for module_path('Foo', {find_pm=>0, find_pod=>1});
$path = pod_path('Foo');

DESCRIPTION

This module is an experimental, alternate implementation of Module::Path, started when Module::Path is at version 0.13. It provides more options (find all instead of only the first found path, find .pmc and .pod files) and has some differences in behavior: it does not do abs_path() by default because I don't think that's the appropriate default.

FUNCTIONS

module_path($mod[, \%opts]) => $path (or ($path1, ...))

Find path of module named $mod in @INC, like require() would (except that it skips references in @INC). $mod can be in the form of Package::SubPkg or Package/SubPkg.pm.

Options:

  • abs => BOOL (default: 0)

    Perform Cwd's abs_path() on the found path(s). Unlike Module::Path, will die if the absolutization fails, because I don't think it's module_path()'s responsibility to trap weirdness of path.

  • all => BOOL (default: 0)

    Instead of returning the first found path, find all.

  • find_pm => BOOL (default: 1)

  • find_pmc => BOOL (default: 1)

    Whether to find .pmc files. Like require(), .pmc files are searched first before .pm.

  • find_pod => BOOL (default: 0)

pod_path($mod[, \%opts]) => $path (or ($path1, ...))

Equivalent to:

module_path($mod, {find_pm=>0, find_pod=>1});

HOMEPAGE

Please visit the project's homepage at https://metacpan.org/release/Alt-Module-Path-SHARYANTO.

SOURCE

Source repository is at https://github.com/sharyanto/perl-Alt-Module-Path-SHARYANTO.

BUGS

Please report any bugs or feature requests on the bugtracker website https://rt.cpan.org/Public/Dist/Display.html?Name=Alt-Module-Path-SHARYANTO

When submitting a bug or request, please include a test-file or a patch to an existing test-file that illustrates the bug or desired feature.

AUTHOR

Steven Haryanto <stevenharyanto@gmail.com>

COPYRIGHT AND LICENSE

This software is copyright (c) 2014 by Steven Haryanto.

This is free software; you can redistribute it and/or modify it under the same terms as the Perl 5 programming language system itself.