lib::xi - Installs missing modules on demand
This document describes lib::xi version 0.05.
# to install missing libaries automatically $ perl -Mlib::xi script.pl # with cpanm's options $ perl -Mlib::xi,-q script.pl # to install missing libaries to extlib/ (with cpanm -l extlib) $ perl -Mlib::xi=extlib script.pl # with cpanm options $ perl -Mlib::xi=extlib,-q script.pl
When you execute a script found in, for example, gist, you'll be annoyed at missing libraries and will install those libraries by hand with a CPAN client. We have repeated such a task, which violates the great virtue of Laziness. Stop doing it! Make computers do it!
gist
lib::xi is a pragma to install missing libraries if and only if they are required.
lib::xi
The mechanism is that when the perl interpreter cannot find a library required, this pragma try to install it with cpanm and tell it to the interpreter.
cpanm
use lib::xi ?$install_dir, ?@cpanm_opts
Setups the lib::xi hook into @INC.
@INC
If $install_dir is specified, it is used as the install directory as cpanm --local-lib $install_dir, adding $install_dir/lib/perl5 to @INC (i.e. use lib::xi 'extlib' also means use lib 'extlib/lib/perl5').
$install_dir
cpanm --local-lib $install_dir
$install_dir/lib/perl5
use lib::xi 'extlib'
use lib 'extlib/lib/perl5'
If the first argument starts -, it is regarded as @cpanm_opts.
-
@cpanm_opts
See "require" in perlfunc for the @INC hook specification details.
Perl 5.8.1 or later.
All complex software has bugs lurking in it, and this module is no exception. If you find a bug please either email me, or add the bug to cpan-RT.
cpanm (App::cpanminus)
Fuji, Goro (gfx) <gfuji@cpan.org>
Copyright (c) 2011, Fuji, Goro (gfx). All rights reserved.
This library is free software; you can redistribute it and/or modify it under the same terms as Perl itself.
To install lib::xi, copy and paste the appropriate command in to your terminal.
cpanm lib::xi
CPAN shell
perl -MCPAN -e shell install lib::xi
For more information on module installation, please visit the detailed CPAN module installation guide.