App-perlbrew

 view release on metacpan or  search on metacpan

Changes  view on Meta::CPAN


0.71
	- Released at 2014-09-13T19:59:15+0200
	- Fix a few bugs of having unwanted values in PERL5LIB when switching between libs

0.70
	- Released at 2014-09-02T20:41:15+0900
	- download the fatpacked perlbrew from an http:// url.
	- protect fatpacked perlbrew from PERL5LIB, thanks to dagolden++
	- avoid several warnings, thanks to DabeDotCom++
	- making perlbrew a bit friendlier to init.d script, thanks to maxhq++ . see also https://github.com/gugod/App-perlbrew/pull/404
	- make it possible to override PERLBREWURL before invoking installers

0.69
	- Released at 2014-06-10T23:32:05+0200
	- fix 'perlbrew env' breakage by just avoiding bad local::lib versions.

0.68
	- Released at 2014-06-07T15:08:00+0200
	- disable SSL cert checks. GH #385.
	- "perlbrew download stable" works as on expects. GH #383

lib/App/Perlbrew/HTTP.pm  view on Meta::CPAN

our $HTTP_VERBOSE = 0;
our $HTTP_USER_AGENT_PROGRAM;

my %commands = (
    curl => {
        test     => '--version >/dev/null 2>&1',
        get      => '--silent --location --fail -o - {url}',
        download => '--silent --location --fail -o {output} {url}',
        order    => 1,

        # Exit code is 22 on 404s etc
        die_on_error => sub { die 'Page not retrieved; HTTP error code 400 or above.' if ($_[ 0 ] >> 8 == 22); },
    },
    wget => {
        test     => '--version >/dev/null 2>&1',
        get      => '--quiet -O - {url}',
        download => '--quiet -O {output} {url}',
        order    => 2,

        # Exit code is not 0 on error
        die_on_error => sub { die 'Page not retrieved: fetch failed.' if ($_[ 0 ]); },
    },
    fetch => {
        test     => '--version >/dev/null 2>&1',
        get      => '-o - {url}',
        download => '-o {output} {url}',
        order    => 3,

        # Exit code is 8 on 404s etc
        die_on_error => sub { die 'Server issued an error response.' if ($_[ 0 ] >> 8 == 8); },
    }
);

sub http_user_agent_program {
    $HTTP_USER_AGENT_PROGRAM ||= do {
        my $program;

        for my $p (sort {$commands{$a}{order}<=>$commands{$b}{order}} keys %commands) {
            my $code = system("$p $commands{$p}->{test}") >> 8;

lib/App/perlbrew.pm  view on Meta::CPAN

use App::Perlbrew::Path ();
use App::Perlbrew::Path::Root ();
use App::Perlbrew::HTTP qw( http_download http_get );
use App::Perlbrew::Patchperl qw( maybe_patchperl );
use App::Perlbrew::Sys;

### global variables

# set $ENV{SHELL} to executable path of parent process (= shell) if it's missing
# (e.g. if this script was executed by a daemon started with "service xxx start")
# ref: https://github.com/gugod/App-perlbrew/pull/404
$ENV{SHELL} ||= App::Perlbrew::Path->new( "/proc", getppid, "exe" )->readlink if -d "/proc";

local $SIG{__DIE__} = sub {
    my $message = shift;
    warn $message;
    exit(1);
};

our $CONFIG;
our $PERLBREW_ROOT;

t/failure-command-install-cpanm.t  view on Meta::CPAN


use App::perlbrew;
$App::perlbrew::PERLBREW_ROOT = my $perlbrew_root = tempdir( CLEANUP => 1 );
$App::perlbrew::PERLBREW_HOME = my $perlbrew_home = tempdir( CLEANUP => 1 );

{
    no warnings 'redefine';
    sub App::perlbrew::http_get {
        my ($url) = @_;
        like $url, qr/cpanm$/, "GET cpanm url: $url";
        return "404 not found.";
    }
}

describe "App::perlbrew->install_cpanm" => sub {
    it "should no produced 'cpanm' in the bin dir, if the downloaded content seems to be invalid." => sub {
        my $error;
        my $error_produced = 0;
        eval {
            my $app = App::perlbrew->new("install-cpanm", "-q");
            $app->run();

t/failure-command-install-cpm.t  view on Meta::CPAN


use App::perlbrew;
$App::perlbrew::PERLBREW_ROOT = my $perlbrew_root = tempdir( CLEANUP => 1 );
$App::perlbrew::PERLBREW_HOME = my $perlbrew_home = tempdir( CLEANUP => 1 );

{
    no warnings 'redefine';
    sub App::perlbrew::http_get {
        my ($url) = @_;
        like $url, qr/cpm$/, "GET cpm url: $url";
        return "404 not found.";
    }
}

describe "App::perlbrew->install_cpm" => sub {
    it "should no produced 'cpm' in the bin dir, if the downloaded content seems to be invalid." => sub {
        my $error;
        my $error_produced = 0;
        eval {
            my $app = App::perlbrew->new("install-cpm", "-q");
            $app->run();



( run in 0.945 second using v1.01-cache-2.11-cpan-39bf76dae61 )