Skip Menu |

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

Report information
The Basics
Id: 27126
Status: resolved
Priority: 0/
Queue: YAML-Tiny

People
Owner: Nobody in particular
Requestors: jloverso [...] mathworks.com
Cc:
AdminCc:

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



Subject: YAML::Tiny->read() returns document header if it has a comment (+FIX)
(N.B. This is broken in 1.05 also, although that isn't an option in the drop down.) YAML::Tiny->read() will return the YAML header if it isn't empty, or rather, if it has a comment in it. A number of 'META.yml' files now contain a command string in the document header like this: --- #YAML:1.0 This makes it incompatible with YAML and YAML::Syck and breaks Module::Inspector (see below) Here's what happens when it's parsed: * DB<51> x @x = YAML::LoadFile("Test-Simple/META.yml") 0 HASH(0x26114e0) 'abstract' => undef 'distribution_type' => 'module' 'generated_by' => 'ExtUtils::MakeMaker version 6.31' 'license' => 'perl' 'meta-spec' => HASH(0x260e320) 'url' => 'http://module-build.sourceforge.net/META-spec-v1.2.html' 'version' => 1.2 'name' => 'Test-Simple' 'requires' => HASH(0x2611200) 'Test::Harness' => 2.03 'version' => 0.67 * DB<52> x @x = YAML::Syck::LoadFile("Test-Simple/META.yml") 0 HASH(0x260e5d0) 'abstract' => undef 'distribution_type' => 'module' 'generated_by' => 'ExtUtils::MakeMaker version 6.31' 'license' => 'perl' 'meta-spec' => HASH(0x260e5a0) 'url' => 'http://module-build.sourceforge.net/META-spec-v1.2.html' 'version' => 1.2 'name' => 'Test-Simple' 'requires' => HASH(0x25bf560) 'Test::Harness' => 2.03 'version' => 0.67 * DB<53> x @x = YAML::Tiny::LoadFile("Test-Simple/META.yml") 0 '#YAML:1.0' 1 HASH(0x25bef90) 'abstract' => undef 'distribution_type' => 'module' 'generated_by' => 'ExtUtils::MakeMaker version 6.31' 'license' => 'perl' 'meta-spec' => HASH(0x260e840) 'url' => 'http://module-build.sourceforge.net/META-spec-v1.2.html' 'version' => 1.2 'name' => 'Test-Simple' 'requires' => HASH(0x25bf670) 'Test::Harness' => 2.03 'version' => 0.67 Because YAML::Tiny returns two elements, it breaks Module::Inspector: DB<54> $mi = Module::Inspector->new(dist_dir => "Test-Simple") DB<55> x $mi->dist_depends Can't use string ("#YAML:1.0") as a HASH ref while "strict refs" in use at /mathworks/devel/sandbox/jloverso/perl-depmod/lib/5.8.8/Module/Inspector.pm line 349. This is my proposed fix to strip the comment from the header: --- .snapshot/nightly.0/lib/5.8.8/YAML/Tiny.pm 2007-05-09 04:26:40.000000000 -0400 +++ lib/5.8.8/YAML/Tiny.pm 2007-05-14 13:09:42.926232000 -0400 @@ -95,8 +95,9 @@ if ( $lines[0] =~ /^---(?:\s*(.+)\s*)?$/ ) { # Handle scalar documents shift @lines; - if ( defined $1 ) { - push @$self, $self->_read_scalar( "$1", [ undef ], \@lines ); + my $header = $1; + if ( defined $header && $header !~ s/^#.*//) { + push @$self, $self->_read_scalar( "$header", [ undef ], \@lines ); next; } }
Subject: This is still a problem in 1.14
From: jloverso [...] mathworks.com
FYI
This has since been resolved