summaryrefslogtreecommitdiff
path: root/dist/Env
diff options
context:
space:
mode:
authorFather Chrysostomos <sprout@cpan.org>2012-11-09 12:50:59 -0800
committerFather Chrysostomos <sprout@cpan.org>2012-11-11 22:17:30 -0800
commitc0965ce9fa2b4d1ab0c61942a01ea3adba29de11 (patch)
tree4e6ac4bd0a0ed6906d1832e8790afe251acdb96b /dist/Env
parent69fba0201d8486aba5747c70275591c12a9b67c1 (diff)
downloadperl-c0965ce9fa2b4d1ab0c61942a01ea3adba29de11.tar.gz
Env.pm: Fix splice in list context
It was passing an extra argument to splice, causing splice @PATH, 0, 0 to append ":0" to the environment variable.
Diffstat (limited to 'dist/Env')
-rw-r--r--dist/Env/lib/Env.pm2
-rw-r--r--dist/Env/t/array.t6
2 files changed, 6 insertions, 2 deletions
diff --git a/dist/Env/lib/Env.pm b/dist/Env/lib/Env.pm
index 1f3713afdf..6e6cd8b230 100644
--- a/dist/Env/lib/Env.pm
+++ b/dist/Env/lib/Env.pm
@@ -211,7 +211,7 @@ sub SPLICE {
my $length = shift;
my @temp = split($sep, $ENV{$$self});
if (wantarray) {
- my @result = splice @temp, $self, $offset, $length, @_;
+ my @result = splice @temp, $offset, $length, @_;
$ENV{$$self} = join($sep, @temp);
return @result;
} else {
diff --git a/dist/Env/t/array.t b/dist/Env/t/array.t
index 9e87f4a6b2..d0291744ad 100644
--- a/dist/Env/t/array.t
+++ b/dist/Env/t/array.t
@@ -6,7 +6,7 @@ use strict;
use Test::More;
plan(skip_all => "skipped for VMS") if $^O eq 'VMS';
-plan(tests => 11);
+plan(tests => 12);
use Env qw(@FOO);
use vars qw(@BAR);
@@ -64,3 +64,7 @@ is_deeply(\@FOO, \@BAR, "Sort");
splice @FOO, 1, 1, 'B';
splice @BAR, 1, 1, 'B';
is_deeply(\@FOO, \@BAR, "Splice");
+
+my $foo = $ENV{FOO};
+() = splice @FOO, 0, 0;
+is $ENV{FOO}, $foo, 'Splice in list context';