++ed by:

1 non-PAUSE user.

Chad Granum
and 1 contributors


local::lib::deps - Maintain a module specific lib path for that modules dependencies.


Maintaining perl module dependencies through a distributions package manager can be a real pain. This module helps by making it easier to simply bundle all your applications dependencies into one lib path specific to the module. It also makes it easy to tell your application where to look for modules.


Bootstrap your modules dependency area in the default location:

    use local::lib::deps;
    $local::lib::deps->install_deps( 'My::Module', 'Dep::One', 'Dep::Two' );

Bootstrap your modules dependency area in a custom location:

    use local::lib::deps;
    $moduledeps = local::lib::deps->new(
        base_path => '/path/to/dep/storage',
    $moduledeps->install_deps( 'My::Module', 'Dep::One', 'Dep::Two', ... );

This will create a directory specifically for the My::Module namespace and install the specified dependencies (and local::lib) there.

To use those deps in your app:

    use local::lib::deps qw/ My::Module My::ModuleTwo/;
    use Dep::One;


    use local::lib::deps;
    BEGIN {
        $moduledeps = local::lib::deps->new(
            base_path => '/path/to/dep/storage',
        $moduledeps->add_paths( qw/ My::Module My::ModuleTwo/ );
    use Dep::One;

To initiate local::lib with the destination directory of your module:

    use local::lib::deps -locallib => 'My::Module';


    use local::lib::deps;
    $moduledeps = local::lib::deps->new(
        module => 'My::Module',
        base_path => '/path/to/dep/storage',


The primary use case for this module is installing dependencies for an application that would conflict in some way with the systems perl or module configuration. It is also useful for applications that have a lot of dependancies for which no distribution specific packages exist. This becomes even more critical when you have a sysadmin that abhors using cpan instead of distro packages.

Using this module as an end user is not very effective. You could potentially rig your application to install all the dependencies necessary to the users home directory every time it is run. This is a bad idea, each user would have their own copy fo the dependencies, and every run it will try to update all the deps.

A better idea is to use this module in your build scripts (Module::Build, or Module::Install). The idea would be to have your 'make' or 'build' task bootstrap the deps folder. Then when the application installs the deps will install as well, but in a way that does not interfer with the rest of the system.

This is even more useful when you are building a package as you can bundle the dependences in your package.


new( module => 'My::Module', base_path => 'path/to/module/libs', cpan_config => {...}, debug => 0 )

Create a new local::lib::deps object.

add_paths( qw/ Module::One Module::Two /)

Add the local::lib path for the specified module to @INC;

locallib( $module )

Will get local::lib setup against the local::lib::deps dir. If called as a class method $module is manditory, if called as an object method $module is ignored.

This is different from add_paths in that any module you install after this will be installed to the specified modules local-lib dir.

install_deps( $module, @deps )

This will bootstrap local::lib into a local::lib::deps folder for the specified module, it will then continue to install (or update) all the dependency modules.


Used internally, documented for completeness. Determines if $self is an object, or the package.



Returns the base path that contains the module dependancy areas. This is documented because you may wish to override this in an application specific subclass.


Get the cpan_config hashref.



Chad Granum chad@opensourcery.com


Copyright (C) 2009 OpenSourcery, LLC

local-lib-deps is free software; you can redistribute it and/or modify it under the terms of the GNU General Public License as published by the Free Software Foundation; either version 2 of the License, or (at your option) any later version.

local-lib-deps is distributed in the hope that it will be useful, but WITHOUT ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License for more details.

You should have received a copy of the GNU General Public License along with this program; if not, write to the Free Software Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA.

local-lib-deps is packaged with a copy of the GNU General Public License. Please see docs/COPYING in this distribution.

1 POD Error

The following errors were encountered while parsing the POD:

Around line 267:

You forgot a '=back' before '=head1'