NAME

Data::Frame::Autobox::Hash - Additional Hash role for Moose::Autobox

VERSION

version 0.004_004

SYNOPSIS

use Moose::Autobox;

Moose::Autobox->mixin_additional_role(
    HASH => "Data::Frame::Autobox::Hash"
);

{ one => 1 }->names;            # [ 'one' ]
{ one => 1 }->isempty;          # false

DESCRIPTION

This is an additional Hash role for Moose::Autobox.

METHODS

isempty

my $isempty = $hash->isempty;

Returns a boolean value for if the hash ref is empty.

names

my $keys = $hash->names;

This is same as the keys method of Moose::Autobox::Hash.

set($key, $value)

$hash->set($key, $value);

This is same as the put method of Moose::Autobox::Hash.

rename($hashref_or_coderef)

my $new_href1 = $href->rename( { $from_key => $to_key, ... } );
my $new_href2 = $href->rename( sub { $_[0] . 'foo' } );

It can take either a hashref of key mappings. If a keys does not exist in the mappings, it would not be renamed. Also this method can take a coderef which transforms the keys.

copy

Shallow copy.

SEE ALSO

Moose::Autobox

Moose::Autobox::Hash

AUTHORS

  • Zakariyya Mughal <zmughal@cpan.org>

  • Stephan Loyd <sloyd@cpan.org>

COPYRIGHT AND LICENSE

This software is copyright (c) 2014, 2019 by Zakariyya Mughal, Stephan Loyd.

This is free software; you can redistribute it and/or modify it under the same terms as the Perl 5 programming language system itself.