virtperl - Virtual perl environments


version 0.1


virtperl command syntax:

    virtperl <command> options [arguments]


    create      Create a new environment.
    new         Synonym for create.
    use         Change to the given environment in current shell.
    list        List the available environments.
    remove      Remove an environment.
    rm          Synonym for remove.
    mkcpanfile  Print a cpanfile of the dist installed in the current env.


    virtperl create moose-based-project
    virtperl use moose-based-project
    cpanm install Moose
    ... hack hack hack...


Run the setup-virtperl script to initialize virtperl. It will output a shell command for sourcing virtperl's shell glue. It is recommended that you put that in your .profile or similar.



Creates a new virtual perl environment. Takes a name as its only argument:

    virtperl create my-new-project


Switches the current shell to use the given environment:

    virtperl use my-other-project


List the environments that are currently setup.

    virtperl list
      * my-other-project


Removes an environment from disk.

    virtperl remove my-new-project


Outputs to STDOUT a cpanfile of all the distributions installed in the current environment. This feature only works if you are using cpanm to install modules - but you've been using cpanm to install your modules.... right?

    virtperl mkcpanfile


A base directory is created to store your environments in $HOME/.virtperl. When a environement is created, a basic directory tree for that environement is created with in the base dir.

When an environment is active, then the PERL_VIRTPERL_CURRENT_ENV env variable is set to that name, anad PERL5OPT is set to include -MApp::VirtPerl::Setup. App::VirtPerl::Setup removes all the entries from @INC except for the core paths and the paths for the current environment.

Because of this, perl -MDBI will not fail in a new virtual environment if DBI is installed in the global environment. However, perl -e 'use DBI;' will not pull in DBI from the global env.

PERL_CPANM_OPT is also changed to when a virutual environment is active to make sure that modules are installed into the virtual env. This means you can just run cpanm whatever and it will DTRT. cpanm should be used for this, as it also installs metadata to allow the mkcpanfile feature to work.


    Chris Reinhardt


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

The full text of the license can be found in the LICENSE file included with this module.


App::perlbrew, App::cpanminus, virtualenv, perl(1)