NAME
Module::LocalLoad - create and use a local lib/ for globally installed packages
SYNOPSIS
my $module = 'IO::File';
load($module) and printf("%s v%s loaded\n", $module, $module->VERSION);
DESCRIPTION
You might find yourself in a situation where you need to change something in the source of a globally installed package. Doing so directly might not be such a good idea, and sometimes not even possible.
This module will help you set up a temporary local lib/ for the modules that you are working on right now. See the "EXAMPLES" section.
EXPORTS
load()
When load() is called with a valid, globally installed package name several things happen. First, we check if the environment variable PERL5HACKLIB
is defined and points to a directory that'll be our new lib/. If the directory already contains a copy of the package, we go ahead and load it, else we must first copy it.
EXAMPLES
You want to muck around in the inner workings of the IO::File module.
# io-file-hack.pl
use Module::LocalLoad;
my $m = 'IO::File';
my $f = $m;
$f =~ s{::}{/}g;
load($m) and printf("%s v%s loaded - %s\n", $m, $m->VERSION, $INC{"$f.pm"});
This will produce something like:
IO::File v1.14 loaded - /tmp/lib/IO/File.pm
Next up, go make some changes to /tmp/lib/IO/File.pm . Don't forget to change the $VERSION variable!
vim /tmp/lib/IO/File.pm
IO::File v1.14.1 loaded - /tmp/lib/IO/File.pm
ENVIRONMENT
- PERL5HACKLIB
Where the temporary lib should be set up.
AUTHOR
\ \ | / /
\ \ - /
\ | /
(O O)
( < )
(-=-)
Magnus Woldrich
CPAN ID: WOLDRICH
magnus@trapd00r.se
http://japh.se
CONTRIBUTORS
None required yet.
COPYRIGHT
Copyright 2011 the Module::LocalLoad "AUTHOR" and "CONTRIBUTORS" as listed above.
LICENSE
This library is free software; you can redistribute it and/or modify it under the same terms as Perl itself.