summary | shortlog | log | commit | commitdiff | tree
raw | patch | inline | side by side (parent: 687157c)
raw | patch | inline | side by side (parent: 687157c)
author | Alex Riesen <raa.lkml@gmail.com> | |
Wed, 22 Aug 2007 16:13:07 +0000 (18:13 +0200) | ||
committer | Junio C Hamano <gitster@pobox.com> | |
Wed, 22 Aug 2007 22:28:58 +0000 (15:28 -0700) |
For reason unknown a package in ActiveState Perl 5.8.7 must implement
READLINE method differently for scalar and array context. The code
tested to work for more sane and recent version of perl (5.8.8 shipped
with Ubuntu), so maybe it was always a requirement.
Signed-off-by: Alex Riesen <raa.lkml@gmail.com>
Signed-off-by: Junio C Hamano <gitster@pobox.com>
READLINE method differently for scalar and array context. The code
tested to work for more sane and recent version of perl (5.8.8 shipped
with Ubuntu), so maybe it was always a requirement.
Signed-off-by: Alex Riesen <raa.lkml@gmail.com>
Signed-off-by: Junio C Hamano <gitster@pobox.com>
perl/Git.pm | patch | blob | history |
diff --git a/perl/Git.pm b/perl/Git.pm
index 8fd36117539b528173e84f1df3acfc754ccc868f..3f4080cbf84e16ab3dd21a82d9948c5646c1c40f 100644 (file)
--- a/perl/Git.pm
+++ b/perl/Git.pm
if ($self->{i} >= scalar @{$self->{data}}) {
return undef;
}
- return $self->{'data'}->[ $self->{i}++ ];
+ my $i = $self->{i};
+ if (wantarray) {
+ $self->{i} = $#{$self->{'data'}} + 1;
+ return splice(@{$self->{'data'}}, $i);
+ }
+ $self->{i} = $i + 1;
+ return $self->{'data'}->[ $i ];
}
sub CLOSE {