Subject: | Data::YAML 0.0.6 Reader Bug with single quoted hash keys |
Date: | Sun, 7 Jun 2009 10:24:52 +0200 |
To: | bug-data-yaml [...] rt.cpan.org |
From: | Christian Augustin <cma [...] snafu.de> |
Hi,
I gave Data::YAML a try and stumbled about a problem with single
quoted strings as hash keys (produced by Data::YAML::Writer 0.0.6) in
Data::YAML::Reader 0.0.6.
Looks like a problem with the $HASH_LINE RegExp using only $QQ_STRING.
By introducing $SQ_STRING it works for me (but perhaps not for all use
cases):
my $QQ_STRING = qr{ " (?: \\. | [^"] )* " }x;
my $SQ_STRING = qr{ ' (?: '' | [^'] )* ' }x;
my $HASH_LINE = qr{ ^ ( $SQ_STRING | $QQ_STRING | \S+ ) \s* : (?: \s
+ (.+?) \s* )? $ }x;
The YAML written by Data::YAML::Writer that caused the problem looked
similiar to this (to prepare a test case):
---
'First key':
- 140
- 0
- 0
- 0
- EUR
'Second key':
- 137
- 20000
- 21060
- 33000
- EUR
...
Kind regards
--
Christian Augustin
mail@caugustin.de