Data::Frame::Autobox - Autobox arrays and hashes for Data::Frame
version 0.0058
use Data::Frame::Autobox; [ 1 .. 5 ]->isempty; # false { one => 1 }->names; # [ 'one' ] { one => 1 }->isempty; # false
This package provides a set of methods for autoboxed arrays and hashes.
my $isempty = $array->isempty;
Returns a boolean value for if the array ref is empty.
my $new_array = $array->grep($coderef);
my $new_array = $array->map($coderef);
my $value = $array->at($idx);
my $uniq_array = $array->uniq;
$array->set($idx, $value);
my $length = $array->length;
This is same as length.
length
my @array = $array->flatten;
Explicitly returns an array.
my $slice = $array->slice($indices);
Shallow copy.
my $new_array = $array->repeat($n);
Repeat for $n times.
$n
my $new_array = $array->repeat_to_length($l);
Repeat to get the length of $l.
$l
my $new_array = $array->intersect($other)
my $new_array = $array->union($other)
my $new_array = $array->setdiff($other)
my $isempty = $hash->isempty;
Returns a boolean value for if the hash ref is empty.
$hash->delete($key);
my $merged_hash = $hash->merge($other);
my $sliced_hash = $hash->hslice($keys);
This is same as hslice.
hslice
my $value = $hash->at($key);
$hash->set($key, $value);
my $bool = $hash->exists($key);
my $keys = $hash->keys;
This is same as keys.
keys
my $values = $hash->values;
my %hash = $hash->flatten;
rename($hashref_or_coderef)
It can take either,
A hashref of key mappings.
If a keys does not exist in the mappings, it would not be renamed.
A coderef which transforms each key.
my $new_href1 = $href->rename( { $from_key => $to_key, ... } ); my $new_href2 = $href->rename( sub { $_[0] . 'foo' } );
autobox
Zakariyya Mughal <zmughal@cpan.org>
Stephan Loyd <sloyd@cpan.org>
This software is copyright (c) 2014, 2019-2021 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.
To install Alt::Data::Frame::ButMore, copy and paste the appropriate command in to your terminal.
cpanm
cpanm Alt::Data::Frame::ButMore
CPAN shell
perl -MCPAN -e shell install Alt::Data::Frame::ButMore
For more information on module installation, please visit the detailed CPAN module installation guide.