Fix git-remote for ActiveState Perl
authorAlex Riesen <raa.lkml@gmail.com>
Wed, 22 Aug 2007 16:13:07 +0000 (18:13 +0200)
committerJunio 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>
perl/Git.pm
index 8fd36117539b528173e84f1df3acfc754ccc868f..3f4080cbf84e16ab3dd21a82d9948c5646c1c40f 100644 (file)
@@ -860,7 +860,13 @@ sub READLINE {
        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 {