Skip Menu |
 

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

Report information
The Basics
Id: 46877
Status: open
Priority: 0/
Queue: Data-YAML

People
Owner: Nobody in particular
Requestors: cma [...] snafu.de
Cc:
AdminCc:

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



MIME-Version: 1.0 (Apple Message framework v935.3)
X-Spam-Status: No, hits=0.0 required=8.0 tests=
X-Mailer: Apple Mail (2.935.3)
X-Trace: 507c636d6140736e6166752e64657c37392e3139332e3232362e387c314d463179 512d30303034574b2d36627c31323434373934373334
content-type: text/plain; charset="utf-8"; delsp="yes"; format="flowed"
Message-ID: <4F81FE46-C90F-46A1-B63B-ECC5AE8642C5 [...] snafu.de>
Received: from la.mx.develooper.com (x1.develooper.com [207.171.7.70]) by diesel.bestpractical.com (Postfix) with SMTP id 2B5B54D8164 for <bug-data-yaml [...] rt.cpan.org>; Fri, 12 Jun 2009 04:19:04 -0400 (EDT)
Received: (qmail 31915 invoked by uid 103); 12 Jun 2009 08:19:04 -0000
Received: from x16.dev (10.0.100.26) by x1.dev with QMQP; 12 Jun 2009 08:19:04 -0000
Received: from waikiki.ops.eusc.inter.net (HELO waikiki.ops.eusc.inter.net) (84.23.254.155) by 16.mx.develooper.com (qpsmtpd/0.80) with ESMTP; Fri, 12 Jun 2009 01:18:59 -0700
Received: from waikiki.ops.eusc.inter.net ([10.155.10.19] helo=localhost) by waikiki.ops.eusc.inter.net with esmtpsa (Exim 4.69) id 1MF1yQ-0004WK-6b for bug-data-yaml [...] rt.cpan.org; Fri, 12 Jun 2009 10:18:54 +0200
Delivered-To: cpan-bug+data-yaml [...] diesel.bestpractical.com
Subject: Data::YAML 0.0.6 does not handle [] and {}
Return-Path: <cma [...] snafu.de>
X-Original-To: bug-data-yaml [...] rt.cpan.org
X-Spam-Check-BY: 16.mx.develooper.com
Date: Fri, 12 Jun 2009 10:18:53 +0200
X-Spam-Level: *
To: bug-data-yaml [...] rt.cpan.org
Content-Transfer-Encoding: 7bit
From: Christian Augustin <cma [...] snafu.de>
X-RT-Original-Encoding: US-ASCII
Content-Length: 2113
Hi, Data::YAML 0.0.6 does not handle empty ARRAYs and HASHes. If those are part of the data structure given to Data::YAML::Writer, Data::YAML::Reader croaks. It could be handled the way YAML::Tiny does it. Here the diffs of a work-around (together with the fix for the single quote problem): Reader.pm: 9c9 < $VERSION = '0.0.6'; --- Show quoted text
> $VERSION = '0.0.6.1';
28c28,29 < my $HASH_LINE = qr{ ^ ($QQ_STRING|\S+) \s* : (?: \s+ (.+?) \s* )? $ }x; --- Show quoted text
> my $SQ_STRING = qr{ ' (?: '' | [^'] )* ' }x; > my $HASH_LINE = qr{ ^ ( $SQ_STRING | $QQ_STRING | \S+ ) \s* : (?: \s
+ (.+?) \s* )? $ }x; 175a177,178 Show quoted text
> return [] if $string eq '[]'; > return {} if $string eq '{}';
Writer.pm: 9c9 < $VERSION = '0.0.6'; --- Show quoted text
> $VERSION = '0.0.6.1';
86c86 < if ( length( $val ) == 0 or $val =~ /\s/ ) { --- Show quoted text
> if ( length( $val ) == 0 or $val =~ /[\s\{\}\[\]]/ ) {
102d101 < $self->_put( $prefix ); 104,107c103,112 < for my $key ( sort keys %$obj ) { < my $value = $obj->{$key}; < $self->_write_obj( $pad . $self->_enc_scalar( $key ) . ':', < $value, $indent + 1 ); --- Show quoted text
> if (keys %$obj) { > $self->_put($prefix); > for my $key ( sort keys %$obj ) { > my $value = $obj->{$key}; > $self->_write_obj( $pad . $self->_enc_scalar($key) . ':', > $value, $indent + 1 ); > } > } > else { > $self->_put( $prefix, ' {}' );
111,112c116,123 < for my $value ( @$obj ) { < $self->_write_obj( $pad . '-', $value, $indent + 1 ); --- Show quoted text
> if (scalar @$obj) { > $self->_put($prefix); > for my $value (@$obj) { > $self->_write_obj( $pad . '-', $value, $indent + 1 ); > } > } > else { > $self->_put( $prefix, ' []' );
The Writer.pm solution isn't elegant, but it does the job. The changes to the Reader.pm are short and rather straight-forward. Kind regards -- Christian Augustin mail@caugustin.de Skype caugustin.de Mobile +49-171-6222361, Fax +49-30-2639173-01906 Holsteinische Str. 19, 12161 Berlin, GERMANY


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.