http://www.perlmonks.org?node_id=1013028


in reply to App::perlbrew - Compiling Perl with thread support

Here is perlbrew(0.58) help, section "install":

COMMAND: INSTALL
    install options perl-<version>
    install options <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 offical CPAN website or
        from the mirror site configured before.

        To configure mirror site, invoke `mirror` command.

    install options perl-blead
    install options 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

    install options /path/to/perl/git/checkout/dir
        Build and install from the given git checkout dir.

    install options /path/to/perl-5.14.0.tar.gz
        Build and install from the given archive file.

    install options http://example.com/mirror/perl-5.12.3.tar.gz
        Build and install from the given URL. Supported URL schemes are
        "http://", "https://", "ftp://" and "file://".

    Options for "install" command:

        -f --force     Force installation
        -j $n          Parallel buildng and testing. ex. C<perlbrew install -j 5 perl-5.14.2>
        -n --notest    Skip testing

           --as        Install the given version of perl by a name.
                       ex. C<perlbrew install perl-5.6.2 --as legacy-perl>

        -D,-U,-A       Switches passed to perl Configure script.
                       ex. C<perlbrew install perl-5.10.1 -D usemymalloc -U uselargefiles>

        --sitecustomize $filename
                       Specify a file to be installed as sitecustomize.pl

    By default, all installations are configured after their name like this:

        sh Configure -de -Dprefix=$PERLBREW_ROOT/perls/<name>

Therefore, the command to install perl 5.16.0 with thread support and to give that perl the name "perl-5.16.0t" should be this:

$ perlbrew install --as perl-5.16.0t -Dusethreads perl-5.16.0

And in fact, I tried that command on Mac OSX 10.6.8, and I was able to successfully install a perl named perl-5.16.0t:

$ perlbrew list * perl-5.16.0 #this perl was already installed perl-5.16.0t #this is the new install $perlbrew use perl-5.16.0t $perlbrew list perl-5.16.0 * perl-5.16.0t

And here's a test program:

use strict; use warnings; use 5.012; use threads; use threads::shared; my $counter :shared; $counter = 1; my $name = 'Joe'; sub do_stuff { my $thread_id = shift; sleep rand 10; say "thread number $thread_id"; say "count: $counter"; $counter++; say $name; $name = "Cathy"; } my @threads; for my $thread_number (1..10) { push @threads, threads->create('do_stuff', $thread_number); } for (@threads) { $_->join; } --output:-- thread number 5 count: 1 Joe thread number 9 count: 2 Joe thread number 3 count: 3 Joe thread number 7 count: 4 Joe thread number 10 count: 5 Joe thread number 4 count: 6 Joe thread number 6 count: 7 Joe thread number 8 count: 8 Joe thread number 1 count: 9 Joe thread number 2 count: 10 Joe

To set perl-5.16.0t as the default when you start up a shell:

$ perlbrew switch perl-5.16.0t

It's possible that the -f option for the perlbrew alias command is the same as for the install command. But in any case, options are optional--that is what the brackets around the option mean--so if you don't know what an option does, then don't use that option.

perlbrew help also says this:

Generic command options: -q --quiet Be quiet on informative output message. -v --verbose Tell me more about it.

The -v option isn't used to specify the perl version, so you can omit it.