I'm trying to read in a CSV data file using Text::CSV::Slurp. It's not working, and my code is so close to the code in Slurp's own example, that I suspect I might have stumbled into some odd configuration problem. Ideas?

In the following test file:

use strict; use Text::CSV::Slurp; use vars qw($file $data); $file = "/orion-reqs/SaferHtml/CradleCSV/2012_03_30/Doc_Sections_SAFER +_Group_Trace.csv"; $data = Text::CSV::Slurp->load(file => $file); 1
$data is an empty array. Going into the debugger, I find that the file is opened correctly, and the header is read. On the first line of data, Slurp calls
$csv->getline_hr($io)
Single step shows that this goes into Text::CSV::AUTOLOAD. That routine expects a method-name that starts with an underscore, which getline_hr doesn't.
my $attr = $Text::CSV::AUTOLOAD; # bound to 'Text::CSV::getline_ +hr' $attr =~ s/.*:://; # Now it's just 'getline_hr' return unless $attr =~ /^_/; # returns with no value
FWIW, my %INC
DB<11> x \%INC 0 HASH(0x98c4780) 'AutoLoader.pm' => '/usr/share/perl5/AutoLoader.pm' 'Carp.pm' => '/usr/share/perl5/Carp.pm' 'Config.pm' => '/usr/lib/perl5/Config.pm' 'Config_git.pl' => '/usr/lib/perl5/Config_git.pl' 'Config_heavy.pl' => '/usr/lib/perl5/Config_heavy.pl' 'DynaLoader.pm' => '/usr/lib/perl5/DynaLoader.pm' 'Exporter.pm' => '/usr/share/perl5/Exporter.pm' 'IO.pm' => '/usr/lib/perl5/IO.pm' 'IO/Handle.pm' => '/usr/lib/perl5/IO/Handle.pm' 'SelectSaver.pm' => '/usr/share/perl5/SelectSaver.pm' 'Symbol.pm' => '/usr/share/perl5/Symbol.pm' 'Term/Cap.pm' => '/usr/share/perl5/Term/Cap.pm' 'Term/ReadLine.pm' => '/usr/share/perl5/Term/ReadLine.pm' 'Text/CSV.pm' => '/home/dthroop/lib/perl/Text/CSV.pm' 'Text/CSV/Slurp.pm' => '/usr/local/share/perl5/Text/CSV/Slurp.pm' 'Text/CSV_XS.pm' => '/usr/lib/perl5/Text/CSV_XS.pm' 'XSLoader.pm' => '/usr/share/perl5/XSLoader.pm' 'dumpvar.pl' => '/usr/share/perl5/dumpvar.pl' 'perl5db.pl' => '/usr/share/perl5/perl5db.pl' 'strict.pm' => '/usr/share/perl5/strict.pm' 'vars.pm' => '/usr/share/perl5/vars.pm' 'warnings.pm' => '/usr/share/perl5/warnings.pm' 'warnings/register.pm' => '/usr/share/perl5/warnings/register.pm'
and what the args to the AUTOLOAD look like:
DB<16> x @_ 0 Text::CSV=HASH(0x8ee2f90) '_AHEAD' => undef '_BOUND_COLUMNS' => undef '_CACHE' => "\"\",\cA\c@\c@\c@\c@\c@\c@\c@\c@\c@\c@\c@\c@\c@\c@\c@\ +c@\c@\c@\c@\c@\c@\cA\c@\c@\c@\c@\c@\cA" '_COLUMN_NAMES' => undef '_EOF' => '' '_FFLAGS' => undef '_FIELDS' => undef '_MODULE' => 'Text::CSV_XS' '_STATUS' => undef '_STRING' => undef 'allow_loose_escapes' => 0 'allow_loose_quotes' => 0 'allow_whitespace' => 0 'always_quote' => 0 'auto_diag' => 0 'binary' => 1 'blank_is_undef' => 0 'empty_is_undef' => 0 'eol' => '' 'escape_char' => '"' 'keep_meta_info' => 0 'quote_char' => '"' 'quote_null' => 1 'quote_space' => 1 'sep_char' => ',' 'types' => undef 'verbatim' => 0 1 IO::Handle=GLOB(0x8cb42e8) -> *Symbol::GEN0 FileHandle({*Symbol::GEN0}) => fileno(6)
Does something look fishy?

In reply to Text::CSV::Slurp losing in getline_hr by throop

Title:
Use:  <p> text here (a paragraph) </p>
and:  <code> code here </code>
to format your post, it's "PerlMonks-approved HTML":



  • Posts are HTML formatted. Put <p> </p> tags around your paragraphs. Put <code> </code> tags around your code and data!
  • Titles consisting of a single word are discouraged, and in most cases are disallowed outright.
  • Read Where should I post X? if you're not absolutely sure you're posting in the right place.
  • Please read these before you post! —
  • Posts may use any of the Perl Monks Approved HTML tags:
    a, abbr, b, big, blockquote, br, caption, center, col, colgroup, dd, del, details, div, dl, dt, em, font, h1, h2, h3, h4, h5, h6, hr, i, ins, li, ol, p, pre, readmore, small, span, spoiler, strike, strong, sub, summary, sup, table, tbody, td, tfoot, th, thead, tr, tt, u, ul, wbr
  • You may need to use entities for some characters, as follows. (Exception: Within code tags, you can put the characters literally.)
            For:     Use:
    & &amp;
    < &lt;
    > &gt;
    [ &#91;
    ] &#93;
  • Link using PerlMonks shortcuts! What shortcuts can I use for linking?
  • See Writeup Formatting Tips and other pages linked from there for more info.