ingydotnet / io-all-pm

All in One Perl IO
http://search.cpan.org/dist/IO-All/
38 stars 20 forks source link

head() returns as soon as it reads any line with only "0" #44

Closed paxunix closed 10 years ago

paxunix commented 10 years ago

Repro: (echo 1; echo 0; echo 2) | perl -MIO::All -le 'print join("\n", io("/dev/stdin")->chomp->head())' 1

and should output 1 0 2

This is due to push @return, ($self->getline or last); since it's not checking for defined($self->getline), it will also fail on empty lines or any other line that is false-y.

shlomif commented 10 years ago

This should be fixed in this commit: https://github.com/ingydotnet/io-all-pm/commit/fe803978ca4d79ee289dee5e8625b5b594ee25af . Please test.

Regards,

-- Shlomi Fish

shlomif commented 10 years ago

Oh, and thanks for reporting it.

frioux commented 10 years ago

Released, thanks @shlomif

shlomif commented 10 years ago

On Tue, 06 May 2014 13:27:47 -0700 fREW Schmidt notifications@github.com wrote:

Released, thanks @shlomif

Thanks! And you're welcome.

Regards,

Shlomi Fish