#!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
        available      List perls available to install
        list           List installed perls
        use            Use the specified perl in current shell
        off            Turn off perlbrew in current shel
        switch         Permanently use the specified perl as default
        switch-off     Permanently turn off perl
        lib            Manage local::lib directories.
        mirror         Pick a preferred mirror site
        version        Display version
        help           Read more detailed instructions

    See `perlbrew help commands` for the full list of commands.

    See `perlbrew help <command>` for the detail description for the command.

=head1 INITIALIZATION

If you never run perlbrew before, or you do not have a C<~/.perlbrew> directory,
you should perform the initialization process by running:

    perlbrew init

This step needs to be done only once.

If latter on you need to change C<$PERLBREW_ROOT>, you (and all other users
who share the same C<$PERLBREW_ROOT> will have to run this again to make it affective.

=head1 COMMANDS

perlbrew commands:

    init           Initialize perlbrew environment.

    install        Install perl
    uninstall      Uninstall the given installation
    available      List perls available to install
    lib            Manage local::lib directories.
    alias          Give perl installations a new name

    list           List perl installations
    use            Use the specified perl in current shell
    off            Turn off perlbrew in current shel
    switch         Permanently use the specified perl as default
    switch-off     Permanently turn off perlbrew (revert to system perl)

    self-upgrade       Upgrade perlbrew itself.
    install-cpanm      Install cpanm, a friendly companion.
    install-patchperl  Install patchperl

    mirror         Pick a preferred mirror site
    version        Display version
    help           Read more detailed instructions

See `perlbrew help <command>` for detail description of the command.

=head1 COMMAND: INIT

The C<init> command should be manually invoked whenever you (the perlbrew user)
upgrade perlbrew.

However, if the upgrade is done with C<self-upgrade> command, or by running the
one-line installer manually, this command is invoked automatically.

=head1 COMMAND: INSTALL

=over 4

=item B<install> [ perl-<version> | <version> ]

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 | blead ]

A special way to install the blead version of perl, which is downloaded from
this specific URL regardless of mirror settings:

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

=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://>.

=back

=head1 COMMAND: UNINSTALL

Usage: perlbrew uninstall <name>

Uninstalls the given perl installation.

=head1 COMMAND: USE

Usage: perlbrew B<use> [perl-<version> | <version> | <name>]

Use the given version perl in current shell. This will not effect newly opened
shells.

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

=head1 COMMAND: SWITCH

Usage: perlbrew switch [ <name> ]

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.

=head1 COMMAND: LIST

Usage: perlbrew list

List the installed versions of perl.

=head1 COMMAND: AVAILABLE

Usage: perlbrew available

List the available versions of perl on CPAN.

=head1 COMMAND: OFF

Usage: perlbrew off

Temporarily disable perlbrew in the current shell.

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

=head1 COMMAND: SWITCH-OFF

Usage: perlbrew switch-off

Permananently disable perlbrew. Use C<switch> command to re-enable it. Invoke
C<use> command to enable it only in the current shell.

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

=head1 COMMAND: ALIAS

Usage: perlbrew alias [-f] create <name> <alias>

    Create an alias for the installation named <name>.

Usage: perlbrew alias [-f] rename <old_alias> <new_alias>

    Rename the alias to a new name.

Usage: perlbrew alias delete <alias>

    Delete the given alias.

=head1 COMMAND: MIRROR

Usage: perlbrew 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.

=head1 COMMAND: EXEC

Usage: perlbrew exec <command> <args...>

Execute command for all perls, one by one.

For example, run a Hello program:

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

The output depends on your perl installations, and looks 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

Notice that the command is not executed in parallel.

=head1 COMMAND: ENV

Usage: perlbrew env <name>

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/zsh):

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

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

=head1 COMMAND: SYMLINK-EXECUTABLES

Usage: perlbrew symlink-executables <name>

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

You don't need to do this unless you have been using old perlbrew to install
perls, and you find youself confused because the perl that you just installed
appears to be missing after invoking `use` or `switch`. perbrew changes its
installation layout since version 0.11, which generades symlinks to executables
in a better way.

If you just upgraded perlbrew (from 0.11 or earlier versions) and 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

Newly installed perls, whether they are development versions or not, does not
need manually treatment with this command.

=head1 COMMAND: INSTALL-CPANM

Usage: perlbrew install-cpanm

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

For more rationale about the existence of this command, read
<http://www.perlbrew.pl/Perlbrew-and-Friends.html>

=head1 COMMAND: INSTALL-PATCHPERL

Usage: perlbrew install-patchperl

Install the C<patchperl> standalone executable in C<$PERLBREW_ROOT/bin>.  This
is automaticall invoked if your perlbrew installation is done with the
installer, but not with cpan.

For more rationale about the existence of this command, read
<http://www.perlbrew.pl/Perlbrew-and-Friends.html>

=head1 COMMAND: SELF-UPGRADE

Usage: perlbrew self-upgrade

This command upgrades Perlbrew to its latest version.

=head1 COMMAND: VERSION

Usage: perlbrew version

Show the version of perlbrew.

=head1 COMMAND: LIB

Usage:

    perlbrew lib create <lib-name>
    perlbrew lib delete <lib-name>

The `lib` command is used to manipulate local::lib roots inside perl
installations. Effectively it is similar to `perl
-Mlocal::lib=/path/to/lib-name`, but a little bit more than just that.

A lib name can be a short name, containing alphanumeric, like 'awesome', or
a full name, prefixed with a perl installation name and a '@' sign, for
example, 'perl-5.14.2@awesome'.

Here are some a brief examples to use them:

    # Create libs by name
    perlbrew lib create nobita
    perlbrew lib create perl-5.12.3@shizuka

    perlbrew list     # See the list of use/switch targets.

    # Activate lib in current shell.
    perlbrew use perl-5.12.3@nobita
    perlbrew use perl-5.14.2@nobita

    # Activate lib in as default.
    perlbrew switch perl-5.14.2@nobita

    # Clean the lib
    perlbrew lib delete nobita
    perlbrew lib delete perl-5.12.3@shizuka

A "lib" is reference by it's name, which can be a short one consists of letters,
or a fully-qualified one, prefixed with the perl installation name, and an `@`
character in between. Short names are local to current perl. A lib name 'nobita'
can refer to 'perl-5.12.3@nobita' or 'perl-5.14.2@nobita', depending on your
current perl.

When invoking `use` or `switch` command to a lib, always use the long name for
it might be ambigous. A simple rule: the name after `use` or `switch` should be
in the output of `list`.

=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>

Make perlbrew command quieter.

=item B<-v| --verbose>

Make perlbrew command say more.

For C<install> command, this prints the building whole process to STDOUT.

=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
