{"thread":{"id":"9613","subject":"[PATCH] Fix git-remote for ActiveState Perl","startedAt":"2007-08-22T16:13:07Z","lastAt":"2007-08-22T20:19:24Z","messageCount":2,"participants":["Alex Riesen","Junio C Hamano"],"isPatch":true,"patchVersion":1,"patchTotal":null},"messages":[{"id":"51266","messageId":"20070822161307.GA3528@steel.home","threadId":"9613","inReplyTo":null,"subject":"[PATCH] Fix git-remote for ActiveState Perl","fromName":"Alex Riesen","fromEmail":"raa.lkml@gmail.com","sentAt":"2007-08-22T16:13:07Z","receivedAt":"2007-08-22T16:13:07Z","isPatch":true,"sender":{"key":"raa.lkml@gmail.com","avatar":"https://avatars.githubusercontent.com/u/324101?v=4"},"body":"For reason unknown a package in ActiveState Perl 5.8.7 must implement\nREADLINE method differently for scalar and array context. The code\ntested to work for more sane and recent version of perl (5.8.8 shipped\nwith Ubuntu), so maybe it was always a requirement.\n\nSigned-off-by: Alex Riesen <raa.lkml@gmail.com>\n---\n\nWithout this only the first remote can be used if you are unlucky\nenough to use that perl. There are probably more breakages, as only\nfirst line of a file/stream can be read. Not many use Git.pm on\nWindows and ActiveState Perl, so it went unnoticed for long time.\n\n perl/Git.pm |    8 +++++++-\n 1 files changed, 7 insertions(+), 1 deletions(-)\n\ndiff --git a/perl/Git.pm b/perl/Git.pm\nindex 8fd3611..3f4080c 100644\n--- a/perl/Git.pm\n+++ b/perl/Git.pm\n@@ -860,7 +860,13 @@ sub READLINE {\n \tif ($self->{i} >= scalar @{$self->{data}}) {\n \t\treturn undef;\n \t}\n-\treturn $self->{'data'}->[ $self->{i}++ ];\n+\tmy $i = $self->{i};\n+\tif (wantarray) {\n+\t\t$self->{i} = $#{$self->{'data'}} + 1;\n+\t\treturn splice(@{$self->{'data'}}, $i);\n+\t}\n+\t$self->{i} = $i + 1;\n+\treturn $self->{'data'}->[ $i ];\n }\n \n sub CLOSE {\n-- \n1.5.3.rc6.19.g4d600f\n"},{"id":"51288","messageId":"7vr6lviapf.fsf@gitster.siamese.dyndns.org","threadId":"9613","inReplyTo":"20070822161307.GA3528@steel.home","subject":"Re: [PATCH] Fix git-remote for ActiveState Perl","fromName":"Junio C Hamano","fromEmail":"gitster@pobox.com","sentAt":"2007-08-22T20:19:24Z","receivedAt":"2007-08-22T20:19:24Z","isPatch":true,"sender":{"key":"gitster@pobox.com","avatar":"https://avatars.githubusercontent.com/u/54884?v=4"},"body":"Alex Riesen <raa.lkml@gmail.com> writes:\n\n> For reason unknown a package in ActiveState Perl 5.8.7 must implement\n> READLINE method differently for scalar and array context. The code\n> tested to work for more sane and recent version of perl (5.8.8 shipped\n> with Ubuntu), so maybe it was always a requirement.\n\nWell spotted.\n\nUnfortunately, the manual perltie.pod is very sketchy on this\nissue, and only says:\n\n    This method will be called when the handle is read from via <HANDLE>.\n    The method should return undef when there is no more data.\n\nThe default implementation in Tie::StdHandle (Tie/Handle.pm)\ndoes agree with you by doing this:\n\n    sub READLINE { my $fh = $_[0]; <$fh> }\n\nSo I am fairly confident that your patch is the right fix.\n\nInterestingly, CPAN::Tarzip::READLINE (CPAN.pm) gets it wrong ;-)\nand caters only to calls in scalar context if I am reading the\ncode correctly.\n\nThanks.  Will apply.\n"}]}