Skip Menu |
 

This queue is for tickets about the YAML-Syck CPAN distribution.

Report information
The Basics
Id: 87084
Status: resolved
Priority: 0/
Queue: YAML-Syck

People
Owner: Nobody in particular
Requestors: DAMI [...] cpan.org
Cc:
AdminCc:

Bug Information
Severity: (no value)
Broken in: (no value)
Fixed in: (no value)



Subject: magical variable $. treated as undef
Download (untitled) / with headers
text/plain 400b
Dump() incorrectly treats $. as undef. Here is a quick example : use strict; use warnings; use YAML::Syck; my @lines; open my $fh, "<", $0 or die $!; while (<$fh>) { push @lines, {bad_num => $., good_num => $.+0, line => $_}; } print Dump(\@lines); __END__ Output : --- - bad_num: ~ good_num: '1' line: "use strict;\n" - bad_num: ~ good_num: '2' line: "use warnings;\n" <etc.>
From: ozcoder [...] gmail.com
Download (untitled) / with headers
text/plain 840b
Hi, On Fri Jul 19 23:06:22 2013, DAMI wrote: Show quoted text
> Dump() incorrectly treats $. as undef. Here is a quick example : > > use strict; > use warnings; > use YAML::Syck; > > my @lines; > open my $fh, "<", $0 or die $!; > while (<$fh>) { > push @lines, {bad_num => $., good_num => $.+0, line => $_}; > } > > print Dump(\@lines); > > __END__ > Output : > --- > - > bad_num: ~ > good_num: '1' > line: "use strict;\n" > - > bad_num: ~ > good_num: '2' > line: "use warnings;\n" > <etc.>
I can't see an easy way to make that work safely. The parameters to Dump are passed down to the XS function XS_YAML__Syck_DumpYAML and the C code doesn't know about special Perl variables. Example $$ doesn't work either. By adding 0 for good_num, Perl is evaluating that before it becomes an argument for Dump, and so that on works. Gordon
Ticket migrated to github as https://github.com/toddr/YAML-Syck/issues/32


This service is sponsored and maintained by Best Practical Solutions and runs on Perl.org infrastructure.

Please report any issues with rt.cpan.org to rt-cpan-admin@bestpractical.com.