Data-XHash
view release on metacpan or search on metacpan
lib/Data/XHash.pm view on Meta::CPAN
5678910111213141516171819202122232425use
warnings;
scalar store xhash xhashref/
;
use
Carp;
our
@EXPORT_OK
= (
qw/&xhash &xhashref &xh &xhn &xhr &xhrn/
);
# XHash values are stored internally using a ring doubly-linked with
# unweakened references:
# {hash}{$key} => [$previous_link, $next_link, $value, $key]
=head1 NAME
Data::XHash - Extended, ordered hash (commonly known as an associative array
or map) with key-path traversal and automatic index keys
=head1 VERSION
Version 0.09
lib/Data/XHash.pm view on Meta::CPAN
380381382383384385386387388389390391392393394395396397398399400Clear returns the XHash tiedref or object (whichever was used).
=cut
sub CLEAR {
my ($this) = @_;
my $self = tied(%$this) || $this;
if ($self->{hash}) {
# Blow away unweakened refs before tossing the hash.
@$_ = () foreach (values %{$self->{hash}});
}
$self->{hash} = {};
delete $self->{tail};
delete $self->{iter};
$self->{max_index} = -1;
return $this;
}
*clear = \&CLEAR;
( run in 0.218 second using v1.01-cache-2.11-cpan-bb97c1e446a )