App-perlbrew
view release on metacpan or search on metacpan
lib/App/perlbrew.pm view on Meta::CPAN
open $fh, ">", $target;
print $fh $_ for @lines;
close $fh;
}
else {
close($fh);
copy( $executable, $target );
}
chmod( 0755, $target );
my $path = $target->stringify_with_tilde;
print "perlbrew is installed: $path\n" unless $self->{quiet};
$self->run_command_init();
return;
}
sub do_install_git {
lib/App/perlbrew.pm view on Meta::CPAN
my @preconfigure_commands = ( "cd $dist_extracted_dir", "rm -f config.sh Policy.sh", );
unless ( $self->{"no-patchperl"} || $looks_like_we_are_installing_cperl ) {
my $patchperl = $self->root->bin("patchperl");
unless ( -x $patchperl && -f _ ) {
$patchperl = "patchperl";
}
push @preconfigure_commands, 'chmod -R +w .', $patchperl;
}
my $configure_flags = $self->env("PERLBREW_CONFIGURE_FLAGS") || '-de';
my @configure_commands = (
"sh Configure $configure_flags "
. join( ' ',
( map { qq{'-D$_'} } @d_options ),
( map { qq{'-U$_'} } @u_options ),
( map { qq{'-A$_'} } @a_options ),
lib/App/perlbrew.pm view on Meta::CPAN
}
if ( $body_filter && ref($body_filter) eq "CODE" ) {
$body = $body_filter->($body);
}
$self->root->bin->mkpath;
open my $OUT, '>', $out or die "cannot open file($out): $!";
print $OUT $body;
close $OUT;
chmod 0755, $out;
print "\n$program_name is installed to\n\n $out\n\n" unless $self->{quiet};
}
sub do_exit_with_error_code {
my ( $self, $code ) = @_;
exit($code);
}
sub do_system_with_exit_code {
my ( $self, @cmd ) = @_;
lib/App/perlbrew.pm view on Meta::CPAN
require FindBin;
unless ( -w $FindBin::Bin ) {
die "Your perlbrew installation appears to be system-wide. Please upgrade through your package manager.\n";
}
my $TMPDIR = $ENV{TMPDIR} || "/tmp";
my $TMP_PERLBREW = App::Perlbrew::Path->new( $TMPDIR, "perlbrew" );
http_download( 'https://raw.githubusercontent.com/gugod/App-perlbrew/master/perlbrew', $TMP_PERLBREW );
chmod 0755, $TMP_PERLBREW;
my $new_version = qx($TMP_PERLBREW version);
chomp $new_version;
if ( $new_version =~ /App::perlbrew\/(\d+\.\d+)$/ ) {
$new_version = $1;
}
else {
$TMP_PERLBREW->unlink;
die "Unable to detect version of new perlbrew!\n";
}
lib/App/perlbrew.pm view on Meta::CPAN
$shebang,
$preemble,
$path,
'exec ' . $program . ' "$@"',
"\n"
);
open my $fh, ">", "$output" or die $!;
print $fh $shim;
close $fh;
chmod 0755, $output;
if ( $self->{verbose} ) {
print "The shim $output is made.\n";
}
}
sub run_command_make_pp {
my ($self, $program) = @_;
my $current_env = $self->current_env
t/12.destdir.t view on Meta::CPAN
$name = $self->{as} if $self->{as};
my $root = App::Perlbrew::Path->new ($DESTDIR, $ENV{PERLBREW_ROOT});
my $installation_dir = $root->child("perls", $name);
$installation_dir->mkpath;
$root->child("perls", $name, "bin")->mkpath;
my $perl = $root->child("perls", $name, "bin")->child("perl");
write_file($perl, "#!/bin/sh\nperl \"\$@\";\n");
chmod 0755, $perl;
# fake the install
$self->do_install_this("/tmp/fake-src/perl-5.14.2", $dist_version, $dist);
}
use warnings;
## main
note "PERLBREW_ROOT set to $ENV{PERLBREW_ROOT}";
t/12.sitecustomize.t view on Meta::CPAN
my $name = $dist;
$name = $self->{as} if $self->{as};
my $root = App::Perlbrew::Path->new ($ENV{PERLBREW_ROOT});
my $installation_dir = $root->child("perls", $name);
$installation_dir->mkpath;
$root->child("perls", $name, "bin")->mkpath;
my $perl = $root->child("perls", $name, "bin")->child("perl");
write_file($perl, "#!/bin/sh\nperl \"\$@\";\n");
chmod 0755, $perl;
# fake the install
$self->do_install_this("/tmp/fake-src/perl-5.14.2", $dist_version, $dist);
}
use warnings;
## main
note "PERLBREW_ROOT set to $ENV{PERLBREW_ROOT}";
t/http-ua-detect-non-curl.t view on Meta::CPAN
use Test2::V0;
use FindBin qw($Bin);
BEGIN {
$ENV{PATH} = "$Bin/fake-bin:" . $ENV{PATH};
}
use File::Which qw(which);
use App::Perlbrew::HTTP qw(http_user_agent_program);
chmod 0755, "$Bin/fake-bin/curl";
diag "PATH=$ENV{PATH}";
my $curl_path = which("curl");
diag "curl = $curl_path";
is $curl_path, "$Bin/fake-bin/curl";
my $expected_ua;
if (which("wget")) {
$expected_ua = "wget";
t/test2_helpers.pl view on Meta::CPAN
my $perl = $root->perls ($name, "bin")->child ("perl");
write_file($perl, <<'CODE');
#!/usr/bin/env perl
use File::Basename;
my $name = basename(dirname(dirname($0))), "\n";
$name =~ s/^perl-//;
my ($a,$b,$c) = split /\./, $name;
printf('%d.%03d%03d' . "\n", $a, $b, $c);
CODE
chmod 0755, $perl;
note "(mock) installed $name to $installation_dir";
}
sub mock_perlbrew_install {
my ($name, @args) = @_;
App::perlbrew->new(install => $name, @args)->run();
}
sub mock_perlbrew_off {
( run in 0.279 second using v1.01-cache-2.11-cpan-496ff517765 )