makamaka/Text-CSV — Issue #2: Test::CSV_PP treats eof() differently than CSV_XS
Author: dylanwh
Created: 2012-02-10 17:41:26+00:00
State: open

Text::CSV_PP appears to call eof() as a function, rather than a method.
This is probably incorrect behavior, as the test case below only fails for _PP, not _XS.

```perl

#!/usr/bin/env perl
use strict;
use warnings;
use Test::More;

use Text::CSV_PP;
use Text::CSV_XS;

BEGIN {
package FakeFileHandle;

sub new { return bless { line => "foo,bar,baz\n" }, shift }

sub getline {
my $self = shift;
return delete $self->{line};
}

sub eof {
my $self = shift;
return not exists $self->{line};
}
};

PP: {
my $pp = Text::CSV_PP->new({binary => 1});
my $fh = FakeFileHandle->new;
ok(!$fh->eof);
eval {
is_deeply( $pp->getline($fh), [qw[ foo bar baz ]]);
};
is($@, '', "no exception thrown");
ok($fh->eof);
}

XS: {
my $pp = Text::CSV_XS->new({binary => 1});
my $fh = FakeFileHandle->new;
ok(!$fh->eof);
eval {
is_deeply( $pp->getline($fh), [qw[ foo bar baz ]]);
};
is($@, '', "no exception thrown");
ok($fh->eof);
}

done_testing;
```