Stats-LikeR
view release on metacpan or search on metacpan
t/read_table.input_record_separator.t view on Meta::CPAN
#!/usr/bin/env perl
# read_table does not depend on the caller's $/.
#
# _parse_csv_file() reads with sv_gets(), which splits on PL_rs -- the current
# value of $/ -- rather than on newlines. Until 0.319 a `local $/;` anywhere up
# the call stack, the everyday idiom for slurping some other file, made the
# whole CSV one "line": read_table returned [] and said nothing. A record
# length ($/ = \N) cut rows at N bytes and died with a misleading alignment
# error, and paragraph mode ($/ = '') merged rows. The perl side's peek at the
# first line, which recovers a commented-out header, read with $/ as well.
#
# There is no R or pandas counterpart: $/ is perl's. What is pinned is that
# every setting of it reads the same table as the default does, on both of
# read_table's paths, and that a filter -- user code, run while the parser is
# mid-file -- still sees the caller's $/ and not the parser's.
require 5.010;
use strict;
use warnings FATAL => 'all';
use Test::More;
( run in 1.510 second using v1.01-cache-2.11-cpan-ac8be02dad9 )