Text::CSV_PP::Simple作ってみた

あんまり考えずに作った。


package Text::CSV_PP::Simple;
use strict;
use warnings;
use base qw/Text::CSV_PP Class::Data::Inheritable/;
use IO::File;
use Scalar::Util qw/blessed/;
__PACKAGE__->mk_classdata('io');
sub getline {
my ($self,$io) = @_;
unless ( blessed $io || $self->io ) {
$self->io( IO::File->new( $io, "r") )
or die "Error : $io not found. $!";
}
elsif ( ! $self->io ) {
$self->io($io);
}
$self->parse($self->io->getline()) or return;
[ $self->fields() ];
}
1;

ひそかに便利?

(追記)

Text::CSV_PP::SimpleよりもText::CSV_PP::SimpleIOの方がネーミングセンスバッチグーかも。
むしろ、Text::CSV_PP::IOSimpleか?