Skip Menu |

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

Report information
The Basics
Id: 32732
Status: rejected
Priority: 0/
Queue: YAML-Tiny

People
Owner: Nobody in particular
Requestors: DAMS [...] cpan.org
Cc:
AdminCc:

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



Subject: [PATCH] Support for tied hash (thus ordered data)
Hi. This patch allows to use a provided module name to create tied hashes and use them when loading a yaml string. That way, the data order can be preserved. The pach includes more POD doc.
Subject: YAML-Tiny-1.25_TieHash.patch
Only in YAML-Tiny-1.25: Makefile Only in YAML-Tiny-1.25: blib diff -ru YAML-Tiny-1.25_old/lib/YAML/Tiny.pm YAML-Tiny-1.25/lib/YAML/Tiny.pm --- YAML-Tiny-1.25_old/lib/YAML/Tiny.pm 2008-01-28 16:39:05.000000000 +0700 +++ YAML-Tiny-1.25/lib/YAML/Tiny.pm 2008-01-28 18:45:54.000000000 +0700 @@ -14,6 +14,18 @@ }; } +our $TieHashModule = undef; + +# used to create a hashref, possibly using hash ties (for instance, to get ordered hash) +sub _create_hashref { + $TieHashModule or return {}; + eval ("require $TieHashModule"); + $@ and die "YAML::Tiny failed requiring '$TieHashModule', specified to be used as a hash tie"; + my %hash; + tie %hash, $TieHashModule; + return \%hash; +} + my $ESCAPE_CHAR = '[\\x00-\\x08\\x0b-\\x0d\\x0e-\\x1f\"\n]'; # Escapes for unprintable characters @@ -100,7 +112,7 @@ } elsif ( $lines[0] =~ /^(\s*)\w/ ) { # A hash at the root - my $document = { }; + my $document = _create_hashref(); push @$self, $document; $self->_read_hash( $document, [ length($1) ], \@lines ); @@ -196,7 +208,7 @@ # Inline nested hash my $indent2 = length("$1"); $lines->[0] =~ s/-/ /; - push @$array, { }; + push @$array, _create_hashref(); $self->_read_hash( $array->[-1], [ @$indent, $indent2 ], $lines ); } elsif ( $lines->[0] =~ /^\s*\-(\s*)(.+?)\s*$/ ) { @@ -222,7 +234,7 @@ } } elsif ( $lines->[0] =~ /^(\s*)\w/ ) { - push @$array, { }; + push @$array, _create_hashref(); $self->_read_hash( $array->[-1], [ @$indent, length("$1") ], $lines ); } else { @@ -279,7 +291,7 @@ # Null hash entry $hash->{$key} = undef; } else { - $hash->{$key} = {}; + $hash->{$key} = _create_hashref(); $self->_read_hash( $hash->{$key}, [ @$indent, length($1) ], $lines ); } } @@ -411,7 +423,7 @@ die "YAML::Tiny does not support circular references"; } my @lines = (); - foreach my $name ( sort keys %$hash ) { + foreach my $name ( $TieHashModule ? sort keys %$hash : keys %$hash ) { my $el = $hash->{$name}; my $line = (' ' x $indent) . "$name:"; my $type = ref $el; @@ -608,8 +620,8 @@ sense of. L<YAML::Tiny> does not generate comments, it won't necesarily preserve the -order of your hashes, and it will normalise if reading in and writing out -again. +order of your hashes (except if you use C<YAML::Tiny::TieHashModule>, see +below), and it will normalise if reading in and writing out again. It only supports a very basic subset of the full YAML specification. @@ -992,6 +1004,19 @@ Reads the YAML stream from a file instead of a string. +=head1 VARIABLES + +=head2 C<YAML::Tiny::TieHashModule> + +This module variable can be use to specify a module to be used to ie hashes +against, thus providing more features to the hashes. For instance, using +Tie::IxHash, Tie::Hash::Indexed or Ties::Hash::Sorted, the order of YAML data +can be preserved, or sorted. The following example rounds-trip better : + + local $YAML::Tiny::TieHashModule = 'Tie::IxHash'; + my ($structure) = YAML::Tiny::LoadFile($filename); + my $output = YAML::Tiny::DumpFile($filename); + =head1 SUPPORT Bugs should be reported via the CPAN bug tracker at Only in YAML-Tiny-1.25: pm_to_blib
Subject: Re: [rt.cpan.org #32732] [PATCH] Support for tied hash (thus ordered data)
Date: Tue, 29 Jan 2008 08:16:34 +1100
To: bug-YAML-Tiny [...] rt.cpan.org
From: "Adam Kennedy" <adamkennedybackup [...] gmail.com>
This is an interesting patch, but unfortunately I think it adds more complexity than I would like to see (The mandate of ::Tiny is to be as small as possible). Since mappings in YAML are inherently non-ordered, this is also a non-spec addition. I think it might be better to see this added as a sub-class in a separate distribution... perhaps YAML::Tiny::Tie(d) ? Adam K On 28/01/2008, Damien Krotkine via RT <bug-YAML-Tiny@rt.cpan.org> wrote: Show quoted text
> > Mon Jan 28 06:49:08 2008: Request 32732 was acted upon. > Transaction: Ticket created by DAMS > Queue: YAML-Tiny > Subject: [PATCH] Support for tied hash (thus ordered data) > Broken in: (no value) > Severity: Normal > Owner: Nobody > Requestors: DAMS@cpan.org > Status: new > Ticket <URL: http://rt.cpan.org/Ticket/Display.html?id=32732 > > > > Hi. > > This patch allows to use a provided module name to create tied hashes and use them when > loading a yaml string. That way, the data order can be preserved. The pach includes more POD > doc. > > > > > Only in YAML-Tiny-1.25: Makefile > Only in YAML-Tiny-1.25: blib > diff -ru YAML-Tiny-1.25_old/lib/YAML/Tiny.pm YAML-Tiny-1.25/lib/YAML/Tiny.pm > --- YAML-Tiny-1.25_old/lib/YAML/Tiny.pm 2008-01-28 16:39:05.000000000 +0700 > +++ YAML-Tiny-1.25/lib/YAML/Tiny.pm 2008-01-28 18:45:54.000000000 +0700 > @@ -14,6 +14,18 @@ > }; > } > > +our $TieHashModule = undef; > + > +# used to create a hashref, possibly using hash ties (for instance, to get ordered hash) > +sub _create_hashref { > + $TieHashModule or return {}; > + eval ("require $TieHashModule"); > + $@ and die "YAML::Tiny failed requiring '$TieHashModule', specified to be used as a hash tie"; > + my %hash; > + tie %hash, $TieHashModule; > + return \%hash; > +} > + > my $ESCAPE_CHAR = '[\\x00-\\x08\\x0b-\\x0d\\x0e-\\x1f\"\n]'; > > # Escapes for unprintable characters > @@ -100,7 +112,7 @@ > > } elsif ( $lines[0] =~ /^(\s*)\w/ ) { > # A hash at the root > - my $document = { }; > + my $document = _create_hashref(); > push @$self, $document; > $self->_read_hash( $document, [ length($1) ], \@lines ); > > @@ -196,7 +208,7 @@ > # Inline nested hash > my $indent2 = length("$1"); > $lines->[0] =~ s/-/ /; > - push @$array, { }; > + push @$array, _create_hashref(); > $self->_read_hash( $array->[-1], [ @$indent, $indent2 ], $lines ); > > } elsif ( $lines->[0] =~ /^\s*\-(\s*)(.+?)\s*$/ ) { > @@ -222,7 +234,7 @@ > } > > } elsif ( $lines->[0] =~ /^(\s*)\w/ ) { > - push @$array, { }; > + push @$array, _create_hashref(); > $self->_read_hash( $array->[-1], [ @$indent, length("$1") ], $lines ); > > } else { > @@ -279,7 +291,7 @@ > # Null hash entry > $hash->{$key} = undef; > } else { > - $hash->{$key} = {}; > + $hash->{$key} = _create_hashref(); > $self->_read_hash( $hash->{$key}, [ @$indent, length($1) ], $lines ); > } > } > @@ -411,7 +423,7 @@ > die "YAML::Tiny does not support circular references"; > } > my @lines = (); > - foreach my $name ( sort keys %$hash ) { > + foreach my $name ( $TieHashModule ? sort keys %$hash : keys %$hash ) { > my $el = $hash->{$name}; > my $line = (' ' x $indent) . "$name:"; > my $type = ref $el; > @@ -608,8 +620,8 @@ > sense of. > > L<YAML::Tiny> does not generate comments, it won't necesarily preserve the > -order of your hashes, and it will normalise if reading in and writing out > -again. > +order of your hashes (except if you use C<YAML::Tiny::TieHashModule>, see > +below), and it will normalise if reading in and writing out again. > > It only supports a very basic subset of the full YAML specification. > > @@ -992,6 +1004,19 @@ > > Reads the YAML stream from a file instead of a string. > > +=head1 VARIABLES > + > +=head2 C<YAML::Tiny::TieHashModule> > + > +This module variable can be use to specify a module to be used to ie hashes > +against, thus providing more features to the hashes. For instance, using > +Tie::IxHash, Tie::Hash::Indexed or Ties::Hash::Sorted, the order of YAML data > +can be preserved, or sorted. The following example rounds-trip better : > + > + local $YAML::Tiny::TieHashModule = 'Tie::IxHash'; > + my ($structure) = YAML::Tiny::LoadFile($filename); > + my $output = YAML::Tiny::DumpFile($filename); > + > =head1 SUPPORT > > Bugs should be reported via the CPAN bug tracker at > Only in YAML-Tiny-1.25: pm_to_blib > >
Subject: Re: [rt.cpan.org #32732] [PATCH] Support for tied hash (thus ordered data)
Date: Tue, 29 Jan 2008 08:18:07 +1100
To: bug-YAML-Tiny [...] rt.cpan.org
From: "Adam Kennedy" <adamkennedybackup [...] gmail.com>
I should also add that while I'm normally not positive about doing something like adding a stub method in ::Tiny modules just so people can extend it, given the nature of YAML I'd be more-inclined to do so in this case. Adam K
I agree and fully understand your position. I had the same opinion and wanted to create YAML::Tiny::Tie (or similar name) at the first place, but then I thought you could find it impolite to do it so without having your word to say. However, as we agree, do you mind if I release YAML::Tiny::Tie soon ? Thanks, dams
Subject: Re: [rt.cpan.org #32732] [PATCH] Support for tied hash (thus ordered data)
Date: Tue, 29 Jan 2008 14:00:50 +1100
To: bug-YAML-Tiny [...] rt.cpan.org
From: "Adam Kennedy" <adamkennedybackup [...] gmail.com>
No problem, go for it. If you need a one-line patch from me to add support for sub-classing the hash, resend it. Adam K On 29/01/2008, Damien Krotkine via RT <bug-YAML-Tiny@rt.cpan.org> wrote: Show quoted text
> > Queue: YAML-Tiny > Ticket <URL: http://rt.cpan.org/Ticket/Display.html?id=32732 > > > I agree and fully understand your position. I had the same opinion and wanted to create > YAML::Tiny::Tie (or similar name) at the first place, but then I thought you could find it impolite > to do it so without having your word to say. > > However, as we agree, do you mind if I release YAML::Tiny::Tie soon ? > > Thanks, > dams >
From: DAMS [...] cpan.org
Thanks, the patch is attached. I added support for _create_arrayref overloading as well. I had to add $DontUseAzOrdering to avoid the hash keys hard-coded sorting. It looks a bit ugly to use a module variable for that purpose, but as $self is [ @_ ], it's not easy to add a property to the object without changing its internal structure. If you have a better implementation for this, or any suggestion, please share them with me :) Instead of YAML::Tiny::Tie, I'll probably add YAML::Tiny::Ordered, as What would be YAML::Tiny::Tie is really a 5 liner (see the POD part o the supplied patch Cheers, dams Le Lun. Jan. 28 22:01:04 2008, adamkennedybackup@gmail.com a écrit : Show quoted text
> No problem, go for it. > > If you need a one-line patch from me to add support for sub-classing > the hash, resend it.
Only in YAML-Tiny-1.25: Makefile Only in YAML-Tiny-1.25: blib diff -ru YAML-Tiny-1.25_old/lib/YAML/Tiny.pm YAML-Tiny-1.25/lib/YAML/Tiny.pm --- YAML-Tiny-1.25_old/lib/YAML/Tiny.pm 2008-01-28 16:39:05.000000000 +0700 +++ YAML-Tiny-1.25/lib/YAML/Tiny.pm 2008-01-29 11:36:04.000000000 +0700 @@ -14,6 +14,13 @@ }; } +our $DontForceAzOrdering = undef; + +# used to create new hashrefs and arrayrefs. Can be overloaded to use tied hash +# and arrays, (for instance, to get ordered hash) +sub _create_hashref { {} } +sub _create_arrayref { [] } + my $ESCAPE_CHAR = '[\\x00-\\x08\\x0b-\\x0d\\x0e-\\x1f\"\n]'; # Escapes for unprintable characters @@ -94,13 +101,13 @@ } elsif ( $lines[0] =~ /^\s*\-/ ) { # An array at the root - my $document = [ ]; + my $document = $self->_create_arrayref(); push @$self, $document; $self->_read_array( $document, [ 0 ], \@lines ); } elsif ( $lines[0] =~ /^(\s*)\w/ ) { # A hash at the root - my $document = { }; + my $document = $self->_create_hashref(); push @$self, $document; $self->_read_hash( $document, [ length($1) ], \@lines ); @@ -143,11 +150,11 @@ # Null hash and array if ( $string eq '{}' ) { # Null hash - return {}; + return $self->_create_hashref(); } if ( $string eq '[]' ) { # Null array - return []; + return $self->_create_arrayref(); } # Regular unquoted string @@ -196,7 +203,7 @@ # Inline nested hash my $indent2 = length("$1"); $lines->[0] =~ s/-/ /; - push @$array, { }; + push @$array, $self->_create_hashref(); $self->_read_hash( $array->[-1], [ @$indent, $indent2 ], $lines ); } elsif ( $lines->[0] =~ /^\s*\-(\s*)(.+?)\s*$/ ) { @@ -217,12 +224,12 @@ push @$array, undef; } else { # Naked indenter - push @$array, [ ]; + push @$array, $self->_create_arrayref(); $self->_read_array( $array->[-1], [ @$indent, $indent2 ], $lines ); } } elsif ( $lines->[0] =~ /^(\s*)\w/ ) { - push @$array, { }; + push @$array, $self->_create_hashref(); $self->_read_hash( $array->[-1], [ @$indent, length("$1") ], $lines ); } else { @@ -271,7 +278,7 @@ return 1; } if ( $lines->[0] =~ /^(\s*)-/ ) { - $hash->{$key} = []; + $hash->{$key} = $self->_create_arrayref(); $self->_read_array( $hash->{$key}, [ @$indent, length($1) ], $lines ); } elsif ( $lines->[0] =~ /^(\s*)./ ) { my $indent2 = length("$1"); @@ -279,7 +286,7 @@ # Null hash entry $hash->{$key} = undef; } else { - $hash->{$key} = {}; + $hash->{$key} = $self->_create_hashref(); $self->_read_hash( $hash->{$key}, [ @$indent, length($1) ], $lines ); } } @@ -411,7 +418,7 @@ die "YAML::Tiny does not support circular references"; } my @lines = (); - foreach my $name ( sort keys %$hash ) { + foreach my $name ( $DontForceAzOrdering ? keys %$hash : sort keys %$hash ) { my $el = $hash->{$name}; my $line = (' ' x $indent) . "$name:"; my $type = ref $el; @@ -607,9 +614,12 @@ your average manager or secretary should be able to look at and make sense of. -L<YAML::Tiny> does not generate comments, it won't necesarily preserve the -order of your hashes, and it will normalise if reading in and writing out -again. +By default, L<YAML::Tiny> does not generate comments, it won't necesarily +preserve the order of your hashes and it will normalise if reading in and +writing out again. However you can alter this behaviour : see +C<YAML::Tiny::DontForceAzOrdering> to stop forcing alphabetical reordering of +hashes on output, and see the I<Overload> section to achieve hashes order +preservation. It only supports a very basic subset of the full YAML specification. @@ -992,6 +1002,56 @@ Reads the YAML stream from a file instead of a string. +=head1 OVERLOADING + +When loading YAML content, C<YAML::Tiny> returns a new complex data structure. +To give flexibility on this data structure creation, the following methods are +called when creating hashes and arrays. + +you might want to see also C<YAML::Tiny::DontForceAzOrdering> and L<YAML::Tiny::Ordered>. + +=head2 C<_create_hashref> + +This method is used when a new hashref is needed to create the new data +structure or one of its sub component. By default, this method simply returns +an empty hashref {}. However, you could overload it, use tied hashes and thus +keep the original hash orders : + + package YAML::Tiny::MyOrdered # your own package + use parent qw(YAML::Tiny); # inheritance + use Tie::IxHash; # use ordered hash + + sub _create_hashref { + my %hash; + tie %hash, 'Tie::IxHash'; + return \%hash; + } + +=head2 C<_create_arrayref> + +This method is used when a new arrayref is needed to create the new data +structure or one of its sub component. By default, this method simply returns +an empty arrayref []. However, you could overload it, and for instance use tied +arrays. + +=head1 VARIABLES + +=head2 C<YAML::Tiny::DontForceAzOrdering> + +By default, when serializing a structure to a string/file, C<YAML::Tiny> +reorder the hashes by alphabetical order. If you use overloading to use your +own hash tie, you probably want to disable this feature. Do so by setting +C<YAML::Tiny::DontForceAzOrdering> to a true value when using C<write>, +C<write_string>, C<Dump> or C<DumpFile>. That way, the hash keys order will be +the one return by the C<keys> function. + + my ($structure) = YAML::Tiny::LoadFile($filename); + #... + { + local $YAML::Tiny::DontForceAzOrdering = 1; + my $output = YAML::Tiny::DumpFile($filename); + } + =head1 SUPPORT Bugs should be reported via the CPAN bug tracker at Only in YAML-Tiny-1.25: pm_to_blib
Subject: Re: [rt.cpan.org #32732] [PATCH] Support for tied hash (thus ordered data)
Date: Tue, 29 Jan 2008 16:52:02 +1100
To: bug-YAML-Tiny [...] rt.cpan.org
From: "Adam Kennedy" <adamkennedybackup [...] gmail.com>
I meant more just the bit with the additions... but I assume that you want just the "_create_hash" hooks right? Adam K On 29/01/2008, Damien Krotkine via RT <bug-YAML-Tiny@rt.cpan.org> wrote: Show quoted text
> Only in YAML-Tiny-1.25: Makefile > Only in YAML-Tiny-1.25: blib > diff -ru YAML-Tiny-1.25_old/lib/YAML/Tiny.pm YAML-Tiny-1.25/lib/YAML/Tiny.pm > --- YAML-Tiny-1.25_old/lib/YAML/Tiny.pm 2008-01-28 16:39:05.000000000 +0700 > +++ YAML-Tiny-1.25/lib/YAML/Tiny.pm 2008-01-29 11:36:04.000000000 +0700 > @@ -14,6 +14,13 @@ > }; > } > > +our $DontForceAzOrdering = undef; > + > +# used to create new hashrefs and arrayrefs. Can be overloaded to use tied hash > +# and arrays, (for instance, to get ordered hash) > +sub _create_hashref { {} } > +sub _create_arrayref { [] } > + > my $ESCAPE_CHAR = '[\\x00-\\x08\\x0b-\\x0d\\x0e-\\x1f\"\n]'; > > # Escapes for unprintable characters > @@ -94,13 +101,13 @@ > > } elsif ( $lines[0] =~ /^\s*\-/ ) { > # An array at the root > - my $document = [ ]; > + my $document = $self->_create_arrayref(); > push @$self, $document; > $self->_read_array( $document, [ 0 ], \@lines ); > > } elsif ( $lines[0] =~ /^(\s*)\w/ ) { > # A hash at the root > - my $document = { }; > + my $document = $self->_create_hashref(); > push @$self, $document; > $self->_read_hash( $document, [ length($1) ], \@lines ); > > @@ -143,11 +150,11 @@ > # Null hash and array > if ( $string eq '{}' ) { > # Null hash > - return {}; > + return $self->_create_hashref(); > } > if ( $string eq '[]' ) { > # Null array > - return []; > + return $self->_create_arrayref(); > } > > # Regular unquoted string > @@ -196,7 +203,7 @@ > # Inline nested hash > my $indent2 = length("$1"); > $lines->[0] =~ s/-/ /; > - push @$array, { }; > + push @$array, $self->_create_hashref(); > $self->_read_hash( $array->[-1], [ @$indent, $indent2 ], $lines ); > > } elsif ( $lines->[0] =~ /^\s*\-(\s*)(.+?)\s*$/ ) { > @@ -217,12 +224,12 @@ > push @$array, undef; > } else { > # Naked indenter > - push @$array, [ ]; > + push @$array, $self->_create_arrayref(); > $self->_read_array( $array->[-1], [ @$indent, $indent2 ], $lines ); > } > > } elsif ( $lines->[0] =~ /^(\s*)\w/ ) { > - push @$array, { }; > + push @$array, $self->_create_hashref(); > $self->_read_hash( $array->[-1], [ @$indent, length("$1") ], $lines ); > > } else { > @@ -271,7 +278,7 @@ > return 1; > } > if ( $lines->[0] =~ /^(\s*)-/ ) { > - $hash->{$key} = []; > + $hash->{$key} = $self->_create_arrayref(); > $self->_read_array( $hash->{$key}, [ @$indent, length($1) ], $lines ); > } elsif ( $lines->[0] =~ /^(\s*)./ ) { > my $indent2 = length("$1"); > @@ -279,7 +286,7 @@ > # Null hash entry > $hash->{$key} = undef; > } else { > - $hash->{$key} = {}; > + $hash->{$key} = $self->_create_hashref(); > $self->_read_hash( $hash->{$key}, [ @$indent, length($1) ], $lines ); > } > } > @@ -411,7 +418,7 @@ > die "YAML::Tiny does not support circular references"; > } > my @lines = (); > - foreach my $name ( sort keys %$hash ) { > + foreach my $name ( $DontForceAzOrdering ? keys %$hash : sort keys %$hash ) { > my $el = $hash->{$name}; > my $line = (' ' x $indent) . "$name:"; > my $type = ref $el; > @@ -607,9 +614,12 @@ > your average manager or secretary should be able to look at and make > sense of. > > -L<YAML::Tiny> does not generate comments, it won't necesarily preserve the > -order of your hashes, and it will normalise if reading in and writing out > -again. > +By default, L<YAML::Tiny> does not generate comments, it won't necesarily > +preserve the order of your hashes and it will normalise if reading in and > +writing out again. However you can alter this behaviour : see > +C<YAML::Tiny::DontForceAzOrdering> to stop forcing alphabetical reordering of > +hashes on output, and see the I<Overload> section to achieve hashes order > +preservation. > > It only supports a very basic subset of the full YAML specification. > > @@ -992,6 +1002,56 @@ > > Reads the YAML stream from a file instead of a string. > > +=head1 OVERLOADING > + > +When loading YAML content, C<YAML::Tiny> returns a new complex data structure. > +To give flexibility on this data structure creation, the following methods are > +called when creating hashes and arrays. > + > +you might want to see also C<YAML::Tiny::DontForceAzOrdering> and L<YAML::Tiny::Ordered>. > + > +=head2 C<_create_hashref> > + > +This method is used when a new hashref is needed to create the new data > +structure or one of its sub component. By default, this method simply returns > +an empty hashref {}. However, you could overload it, use tied hashes and thus > +keep the original hash orders : > + > + package YAML::Tiny::MyOrdered # your own package > + use parent qw(YAML::Tiny); # inheritance > + use Tie::IxHash; # use ordered hash > + > + sub _create_hashref { > + my %hash; > + tie %hash, 'Tie::IxHash'; > + return \%hash; > + } > + > +=head2 C<_create_arrayref> > + > +This method is used when a new arrayref is needed to create the new data > +structure or one of its sub component. By default, this method simply returns > +an empty arrayref []. However, you could overload it, and for instance use tied > +arrays. > + > +=head1 VARIABLES > + > +=head2 C<YAML::Tiny::DontForceAzOrdering> > + > +By default, when serializing a structure to a string/file, C<YAML::Tiny> > +reorder the hashes by alphabetical order. If you use overloading to use your > +own hash tie, you probably want to disable this feature. Do so by setting > +C<YAML::Tiny::DontForceAzOrdering> to a true value when using C<write>, > +C<write_string>, C<Dump> or C<DumpFile>. That way, the hash keys order will be > +the one return by the C<keys> function. > + > + my ($structure) = YAML::Tiny::LoadFile($filename); > + #... > + { > + local $YAML::Tiny::DontForceAzOrdering = 1; > + my $output = YAML::Tiny::DumpFile($filename); > + } > + > =head1 SUPPORT > > Bugs should be reported via the CPAN bug tracker at > Only in YAML-Tiny-1.25: pm_to_blib > >
Le Mar. Jan. 29 00:52:20 2008, adamkennedybackup@gmail.com a écrit : Show quoted text
> I meant more just the bit with the additions... but I assume that you > want just the "_create_hash" hooks right?
yes, the _create_hashref bits is the minimum. I think that it makes sense to add _create_arayref) too, but I don't mind. As soo as _create_hashref is there, I can create YAML::Tiny::Ordered However, the problem is the "sort keys %$hash", as it forces the keys reordering on output, which ruins the whole purpose of having tied hash dams
Sounds like this is going to be enough of a problem that it might be better to just cut/paste/modify each of the methods that you need to change. Rejected.