diff --git a/Changes b/Changes index ecdfb93d..ea47c9fc 100644 --- a/Changes +++ b/Changes @@ -1,3 +1,7 @@ +NEXT + - Thanks to our contributors: Joelle Maslak + - bashrc executes properly in bash shells with +h option set + - Allow specification of non-standard Perl location - make-pp now requires the input to be specified with `-i` or `--input`. 0.98 diff --git a/META.json b/META.json index 8ff39616..4ddd1409 100644 --- a/META.json +++ b/META.json @@ -49,7 +49,8 @@ "Test::Output" : "1.03", "Test::Simple" : "1.001002", "Test::Spec" : "0.49", - "Test::TempDir::Tiny" : "0.016" + "Test::TempDir::Tiny" : "0.016", + "Test::Which" : "1.27" } } }, diff --git a/lib/App/perlbrew.pm b/lib/App/perlbrew.pm index d256ce4f..57760de2 100644 --- a/lib/App/perlbrew.pm +++ b/lib/App/perlbrew.pm @@ -2884,7 +2884,9 @@ __perlbrew_purify () { __perlbrew_set_path () { export MANPATH=${PERLBREW_MANPATH:-}${PERLBREW_MANPATH:+:}$(__perlbrew_purify "$(manpath 2>/dev/null)") export PATH=${PERLBREW_PATH:-$PERLBREW_ROOT/bin}:$(__perlbrew_purify "$PATH") - hash -r + if [ -o hashall ] ; then + hash -r + fi } __perlbrew_set_env() { @@ -3434,6 +3436,11 @@ As a result, different users on the same machine can all share the same perlbrew root directory (although only original user that made the installation would have the permission to perform perl installations.) +If you need to install perlbrew using a Perl that isn't either C +or C, set and export the environment variable +C and then install as described above. Note that you +must not use a perlbrew-managed perl. + You may also install perlbrew from CPAN: cpan App::perlbrew diff --git a/perlbrew-install b/perlbrew-install index 389ab7c3..a9eca238 100755 --- a/perlbrew-install +++ b/perlbrew-install @@ -42,13 +42,14 @@ echo echo "## Installing perlbrew" # loop thru available well known Perl installations -for PERL in "/usr/bin/perl" "/usr/local/bin/perl" +for PERL in "/usr/bin/perl" "/usr/local/bin/perl" "$PERLBREW_SYSTEM_PERL" do - [ -x "$PERL" ] && echo "Using Perl <$PERL>" && break + [ -n "$PERL" ] && [ -x "$PERL" ] && echo "Using Perl <$PERL>" && break done if [ ! -x "$PERL" ]; then echo "Need /usr/bin/perl or /usr/local/bin/perl to use $0" + echo "Alternatively, set PERLBREW_SYSTEM_PERL to point at system perl" clean_exit 2 fi diff --git a/t/bashrc_executes.t b/t/bashrc_executes.t new file mode 100644 index 00000000..120c0dee --- /dev/null +++ b/t/bashrc_executes.t @@ -0,0 +1,38 @@ +#!/usr/bin/env perl +use strict; +use warnings; + +use FindBin; +use lib $FindBin::Bin; +use App::perlbrew; +require 'test_helpers.pl'; + +use Test::More; +use Capture::Tiny qw( capture_stderr ); +use File::Which qw( which ); + +note "PERLBREW_ROOT set to $ENV{PERLBREW_ROOT}"; + +subtest "Works without error output on bash where hashing is off", sub { + my $bash = which("bash"); + if (!defined($bash)) { + plan skip_all => "Bash executable not found, skipping this test."; + return; + } + + my $app = App::perlbrew->new('self-install'); + $app->current_shell("bash"); + $app->run; + + my $ret; + my $out = capture_stderr { + my $bash_init = file($ENV{PERLBREW_ROOT}, "etc", "bashrc"); + system("ls $ENV{PERLBREW_ROOT}/etc/bashrc"); + $ret = system($bash, "+h", "-c", "source $bash_init"); + }; + is($out, "", "No error messages in output"); + is($ret, 0, "Return value proper"); +}; + + +done_testing;