Skip Menu |

This queue is for tickets about the Text-CSV CPAN distribution.

Report information
The Basics
Id: 76355
Status: resolved
Priority: 0/
Queue: Text-CSV

People
Owner: Nobody in particular
Requestors: BBYRD [...] cpan.org
Cc: leonerd-cpan [...] leonerd.org.uk
AdminCc:

Bug Information
Severity: (no value)
Broken in:
  • 1.18
  • 1.21
Fixed in: (no value)



Subject: Default EOL doesn't work
Per POD docs, the default for EOL should be $/. However, this is not the case, as shown in this test case: use Text::CSV; my $scalar = ''; print "\$/ = '$/'\n"; open my $fh, ">", \$scalar; my $CSV = Text::CSV->new(); $CSV->print($fh, [1, 2, 3]); $CSV->print($fh, [4, 5, 6]); close $fh; print "\$/ = '$/'\n"; print $scalar; # output is 1,2,34,5,6 This appears to be a problem in both PP/XS versions. It will only work if a "eol => $/" param is put into ->new().
I was about to report this as I've just run into it. Still fails on 1.21: $ perlmodversion Text::CSV 1.21 $ perl -MText::CSV -E 'my $csv = Text::CSV->new; $csv->print(\*STDOUT, [1,2]); $csv->print(\*STDOUT, [3,4])' 1,23,4 -- Paul Evans
I think that it is expected behavior. Would you tell me the reference in POD? Sorry for lazy response. On 2012-4月-06 金 11:16:07, BBYRD wrote: Show quoted text
> Per POD docs, the default for EOL should be $/. However, this is not > the case, as shown in this test case: > > use Text::CSV; > > my $scalar = ''; > print "\$/ = '$/'\n"; > open my $fh, ">", \$scalar; > my $CSV = Text::CSV->new(); > $CSV->print($fh, [1, 2, 3]); > $CSV->print($fh, [4, 5, 6]); > close $fh; > print "\$/ = '$/'\n"; > print $scalar; # output is 1,2,34,5,6 > > This appears to be a problem in both PP/XS versions. It will only work > if a "eol => $/" param is put into ->new().
On Tue Jun 11 04:58:42 2013, MAKAMAKA wrote: Show quoted text
> I think that it is expected behavior. > Would you tell me the reference in POD?
https://metacpan.org/module/Text::CSV#new-attr An end-of-line string to add to rows. undef is replaced with an empty string. ---The default is $\.---
I get the point. Show quoted text
> An end-of-line string to add to rows. undef is replaced with an empty
That description is improper. It should follow the current Text::CSV_XS document. https://metacpan.org/module/Text::CSV_XS#new It doesn't say that default eol is $/ and this behavior is correct. Sorry for confusing you. On 2013-6月-11 火 08:46:10, BBYRD wrote: Show quoted text
> On Tue Jun 11 04:58:42 2013, MAKAMAKA wrote:
> > I think that it is expected behavior. > > Would you tell me the reference in POD?
> > https://metacpan.org/module/Text::CSV#new-attr > > An end-of-line string to add to rows. undef is replaced with an empty > string. ---The default is $\.--- >
Same issue here (V1.32) - The documentation of Text::CSV is incorrect because it explicitely says "eol: The default is $\" - The Text::CSV_XS doc is not really clear about the default being 'undef' Cheers, J. On Wed Jun 12 00:45:18 2013, MAKAMAKA wrote: Show quoted text
> I get the point. >
> > An end-of-line string to add to rows. undef is replaced with an empty
> > That description is improper. > It should follow the current Text::CSV_XS document. > > https://metacpan.org/module/Text::CSV_XS#new > > It doesn't say that default eol is $/ > and this behavior is correct. > > Sorry for confusing you. > > > > On 2013-6月-11 火 08:46:10, BBYRD wrote:
> > On Tue Jun 11 04:58:42 2013, MAKAMAKA wrote:
> > > I think that it is expected behavior. > > > Would you tell me the reference in POD?
> > > > https://metacpan.org/module/Text::CSV#new-attr > > > > An end-of-line string to add to rows. undef is replaced with an empty > > string. ---The default is $\.--- > >
> >
On Fri Apr 11 06:35:21 2014, JETEVE wrote: Show quoted text
> Same issue here (V1.32) > > - The documentation of Text::CSV is incorrect because it explicitely > says "eol: The default is $\" > > - The Text::CSV_XS doc is not really clear about the default being > 'undef'
What is unclear in --8<--- eol my $csv = Text::CSV_XS->new ({ eol => $/ }); $csv->eol (undef); my $eol = $csv->eol; The end-of-line string to add to rows for "print" or the record separator for "getline". When not passed in a parser instance, the default behavior is to accept "\n", "\r", and "\r\n", so it is probably safer to not specify "eol" at all. Passing "undef" or the empty string behave the same. -->8---
On Wed Oct 08 16:25:01 2014, HMBRAND wrote: Show quoted text
> On Fri Apr 11 06:35:21 2014, JETEVE wrote:
> > Same issue here (V1.32) > > > > - The documentation of Text::CSV is incorrect because it explicitely > > says "eol: The default is $\" > > > > - The Text::CSV_XS doc is not really clear about the default being > > 'undef'
> > What is unclear in > --8<--- > eol > my $csv = Text::CSV_XS->new ({ eol => $/ }); > $csv->eol (undef); > my $eol = $csv->eol; > > The end-of-line string to add to rows for "print" or the record > separator for "getline". > > When not passed in a parser instance, the default behavior is to > accept "\n", "\r", and "\r\n", so it is probably safer to not > specify "eol" at all. Passing "undef" or the empty string behave > the same. > -->8---
Closed as 1.91 has the same doc as Text::CSV_XS whose doc seems clear enough. Thanks.