CC: | ingy [...] cpan.org |
Subject: | Bug in YAML::Loader, code tags are executed twice |
Date: | Fri, 04 Dec 2009 09:03:05 +0100 |
To: | bug-YAML [...] rt.cpan.org |
From: | "Erik P. Ostlyngen" <erik.ostlyngen [...] uninett.no> |
When using YAML::Marshall to create perl code tags, the tag code is
executed twice if the tag argument is on the same line (inline). The
following code snippet illustrates the problem:
use YAML;
use YAML::Marshall 'mister';
sub yaml_load {
my $self = shift;
my $node = $self->SUPER::yaml_load(@_);
return "Mr ".$$node;
}
my $yaml = Load(<< '...');
name: !mister Jones
...
print $yaml->{name}, "\n";
-----
Here, the yaml_load method for the 'mister' tag is executed twice.
First with 'Jones' as input, then with 'Mr Jones' as input. So, the
resulting name becomes 'Mr Mr Jones'.
This problem was seen in YAML 0.70, on Linux, Ubuntu Jaunty.
Regards,
EPO