Skip Menu |

This queue is for tickets about the JSON-MultiValueOrdered CPAN distribution.

Report information
The Basics
Id: 91299
Status: new
Priority: 0/
Queue: JSON-MultiValueOrdered

People
Owner: Nobody in particular
Requestors: perl [...] toby.ink
Cc:
AdminCc:

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



CC: bug-JSON-MultiValueOrdered [...] rt.cpan.org
Subject: Re: Question about your module: JSON::MultiValueOrdered
Date: Tue, 10 Dec 2013 17:09:15 -0000
To: "Pablo Graziano" <pablo [...] compugenic.com>
From: "Toby Inkster" <mail [...] tobyinkster.co.uk>
Tie::Hash::MultiValueOrdered is a module for tie-ing hashes, so you're not supposed to create objects of that class directly. The following code should do the trick, but this probably needs better documentation... use strict; use warnings; use JSON::MultiValueOrdered; sub H { tie my %hash, 'Tie::Hash::MultiValueOrdered'; while (my ($k, $v) = splice(@_, 0, 2)) { $hash{$k} = $v; } return \%hash; } my $data = H( name => 'Joe', methods => H( parent => 'arg1', sibling => 'arg2', parent => 'arg3', ), ); print JSON::MultiValueOrdered->new(pretty => 1)->encode($data);