makamaka / Text-CSV

comma-separated values manipulator

Geek Repo:Geek Repo

Github PK Tool:Github PK Tool

->eof with Text::CSV_PP vs Text::CSV_XS

christopherraa opened this issue · comments

Using this code:

#!/usr/bin/env perl                     

use strict;                             
use warnings;                           
use Text::CSV;                          
use IO::All -utf8;                      

my $csv = Text::CSV->new({binary => 1});
$csv->eol("\n");                        

my $io = io 'foo.csv';                  
$csv->getline_all($io, 0, 10);          

All is well when IO::All, Text::CSV and Text::CSV_XS is installed. However, if not installing Text::CSV_XS and thereby using Text::CSV_PP, the same code fails with the following message:

Can't call method "eof" on an undefined value at IO/All/Base.pm line 128.

I have checked that Text::CSV_PP is indeed there by running perl -e 'use Text::CSV_PP;'.

Versions (all from CPAN):

  • Perl : 5.24.0
  • Text::CSV : 1.33
  • IO::All : 0.86

As the error message clearly shows, this is a bug in IO::All, not in Text::CSV_PP. Actually, you can see the same bug without Text::CSV_PP.

use strict;
use warnings;
use IO::All -utf8;

my $io = io 'foo.csv';
print $io->eof ? "EOF" : "NOT EOF";