#!perl
use strict;
use App::perlbrew;

my $app = App::perlbrew->new(@ARGV);
$app->run();

__END__

=head1 NAME

perlbrew - Perl Environment manager.


=head1 SYNOPSIS

    perlbrew <command> [options] [arguments]

    Commonly used commands:
        init           Initialize perlbrew environment.
        install        Install perl
        uninstall      Uninstall the given installation
        list           List installed perls
        use            Use the specified perl in current shell
        available      List perls available to install
        switch         Permanently use the specified perl as default
        mirror         Pick a preferred mirror site
        off            Permanently turn off perlbrew, go back to system Perl
        version        Display version
        help           Read more detailed instructions

    Examples:
        perlbrew install perl-5.14.0
        perlbrew install 5.12.3

        perlbrew list

        perlbrew use perl-5.12.3
        perlbrew switch perl-5.14.0

        perlbrew switch /path/to/special/perl
        perlbrew switch /path/to/special/perl special-perl

        # later
        perlbrew switch special-perl


=head1 COMMANDS

=over 4

=item B<init>

Run this once to setup the C<perlbrew> directory ready for installing
perls into. Run it again if you decide to change C<PERLBREW_ROOT>.


=item B<install> perl-<version-number>

=item B<install> <version-number>

Build and install the given version of perl.

Version numbers usually look like "5.x.xx", or
"perl-5.xx.x-RCx" for release candidates.

The specified perl is downloaded from the CPAN website, unless mirror
setting are present.


=item B<install> perl-blead

=item B<install> blead

A special way to install the blead version of perl.

The blead version is downloaded from:

    http://perl5.git.perl.org/perl.git/snapshot/blead.tar.gz

This command does not consult mirror settings.


=item B<install> /path/to/perl/git/checkout/dir

Build and install from the given git checkout dir.

=item B<install> /path/to/perl-5.14.0.tar.gz

Build and install from the given archive file.

=item B<install> http://example.com/mirror/perl-5.12.3.tar.gz

Build and install from the given URL. Supported URL schemes are C<http://>,
C<https://>, C<ftp://> and C<file://>.

=item B<uninstall> <target>

Uninstalls the given version.

=item B<mirror>

Run this if you want to choose a specific CPAN mirror to install the
perls from. It will display a list of mirrors for you to pick
from. Hit 'q' to cancel the selection.


=item B<list>

List the installed versions of perl.


=item B<use> [perl-<version>]

=item B<use> [<version>]

Switch to the given version of perl only in the current shell. This
will not effect newly opened shells.

You can use as C<perl-version> the special keyword C<system> to stop
using any perlbrew-based perl.

Without a parameter, shows the version of perl currently in use.

=item B<available>

Displays the available versions of perl on CPAN.


=item B<switch> [perl-<version>]

=item B<switch> [<version>]

Switch to the given version, and makes it the default for this and all
future terminal sessions.

Without a parameter, shows the version of perl currently selected.

=item B<alias> [-f] create <name> <alias>

Create an alias for the installation named <name>.

=item B<alias> [-f] rename <old_alias> <new_alias>

Rename the alias to a new name.

=item B<alias> delete <alias>

Delete the given alias.

=item B<off>

Disable perlbrew. Use C<switch> command to re-enable it.

Re-enables the default system Perl, whatever that is.

=item B<exec> command

Execute command for all perls.

For example, run a Hello program:

    perlbrew exec perl -e 'print "Hello from $]\n"'

Depending on your actual installations, the output might look like this:

    perl-5.12.2
    ==========
    Hello word from perl-5.012002
    
    perl-5.12.3
    ==========
    Hello word from perl-5.012003
    
    perl-5.13.10
    ==========
    Hello word from perl-5.013010
    
    perl-5.14.0
    ==========
    Hello word from perl-5.014000

=item B<env> [perl-version]

Low-level command. Use this command to see the list of environment
variables that are set by C<perlbrew> itself for shell integration.

The output is something similar to this (if your shell is bash):

    export PERLBREW_ROOT=/Users/gugod/perl5/perlbrew
    export PERLBREW_VERSION=0.13
    export PERLBREW_PATH=/Users/gugod/perl5/perlbrew/bin:/Users/gugod/perl5/perlbrew/perls/current/bin
    export PERLBREW_PERL=perl-5.12.3

You can also ask for the proper variables for a specific perl version.


=item B<symlink_executables> <perl-version>

Low-level command. Use this command to create the C<perl> executable
symbolic link to , say, C<perl5.13.6>. This is only useful
for development version of perls.

You don't need to do this unless you have been using old perlbrew to
install perls. The installation layout is changed since version 0.11.

If you just upgraded perlbrew and found C<perlbrew switch> failed to work
after you switch to a development release of perl, say, perl-5.13.6, run this command:

    perlbrew symlink_executables perl-5.13.6

This essentially creates this symlink:

   ${PERLBREW_ROOT}/perls/perl-5.13.6/bin/perl
   -> ${PERLBREW_ROOT}/perls/perl-5.13.6/bin/perl5.13.6

=item B<install-cpanm>

Install the C<cpanm> standalone executable in C<$PERLBREW_ROOT/bin>.

=item B<self-upgrade>

This command upgrades Perlbrew to its latest version.

=item B<version>

Show the version of perlbrew.


=back


=head1 OPTIONS

=over 4

=item B<-h| --help>

prints this help.

=item B<-f| --force>

Force installation of a perl.

=item B<-j>

Enable parallel make and test (if supported by the target perl)

  perlbrew install -j 5 perl-5.12.3

=item B<-n| --notest>

Skip the test suite

=item B<-q| --quiet>

Log output to a log file rather than STDOUT. This is the default. The log file is saved in F<$ROOT/build.log>

=item B<-v| --verbose>

Log output to STDOUT rather than a log file.

=item B<--as>

Install a given perl under an alias.

    perlbrew install perl-5.6.2 --as legacy-perl

=item B<-D>, B<-U>, B<-A>

pass through switches to the perl Configure script.

    perlbrew install perl-5.10.1 -D usemymalloc -U uselargefiles

=back


=head1 CONFIGURATION

=over 4

=item PERLBREW_ROOT

By default, perlbrew builds and installs perls into
C<$ENV{HOME}/perl5/perlbrew> directory. To use a different directory,
set this environment variable in your C<bashrc> to the directory
before running perlbrew.

=back


=head1 UPGRADE NOTES

If you upgraded C<perlbrew> from version 0.16 or older, you should do
this cleanup your setup. Failure to do so might make the C<use>
command to fail.

Note the version of perl currently selected with C<perlbrew switch>.
Then turn C<perlbrew off>, and switched back again with C<perlbrew
switch previous-perl-version>.


=head1 SEE ALSO

L<App::perlbrew>, L<App::cpanminus>

=cut
