throop has asked for the wisdom of the Perl Monks concerning the following question:
In the following test file:
$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 callsuse 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
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.$csv->getline_hr($io)
FWIW, my %INCmy $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
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'
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)
|
|---|
| Replies are listed 'Best First'. | |
|---|---|
|
Re: Text::CSV::Slurp losing in getline_hr
by Tux (Canon) on Apr 11, 2012 at 06:29 UTC | |
|
Re: Text::CSV::Slurp losing in getline_hr
by Khen1950fx (Canon) on Apr 10, 2012 at 19:56 UTC |