Class-EHierarchy
view release on metacpan or search on metacpan
lib/Class/EHierarchy.pm view on Meta::CPAN
This method checks for the existence of the specified key in the hash
property. It returns the return value from the B<exists> function, or
undef on non-existent properties or invalid types.
=head2 keys
@keys = $obj->keys($prop);
This method returns a list of keys from the specified hash property.
It returns the return value from the B<keys> function, or undef on
non-existent properties or invalid types.
=head2 merge
$obj->merge($prop, foo => bar);
$obj->merge($prop, 4 => foo, 5 => bar);
This method is a unified method for storing elements in both hashes and
arrays. Hashes elements are simply key/value pairs, while array elements
are provided as ordinal index/value pairs. It returns a boolean value.
=head2 subset
@values = $obj->subset($hash, qw(foo bar) );
@values = $obj->subset($array, 3 .. 5 );
This method is a unified method for retrieving specific element(s) from both
hashes and arrays. Hash values are retrieved in the order of the specified
keys, while array elements are retrieved in the order of the specified ordinal
indexes.
=head2 remove
$obj->remove($prop, @keys);
$obj->remove($prop, 5, 8 .. 10);
This method is a unified method for removing specific elements from both
hashes and arrays. A list of keys is needed for hash elements, a list of
ordinal indexes is needed for arrays.
B<NOTE:> In the case of arrays please note that an element removed in the
middle of an array does cause the following elements to be shifted
accordingly. This method is really only useful for removing a few elements at
a time from an array. Using it for large swaths of elements will likely prove
it to be poorly performing. You're better of retrieving the entire array
yourself via the B<property> method, splicing what you need, and calling
B<property> again to set the new array contents.
=head2 empty
$rv = $obj->empty($name);
This is a unified method for emptying both array and hash properties. This
returns a boolean value.
=head1 DEPENDENCIES
None.
=head1 BUGS AND LIMITATIONS
=head1 CREDIT
The notion and portions of the implementation of opaque objects were lifted
from Damian Conway's L<Class::Std(3)> module. Conway has a multitude of great
ideas, and I'm grateful that he shares so much with the community.
=head1 AUTHOR
Arthur Corliss (corliss@digitalmages.com)
=head1 LICENSE AND COPYRIGHT
This software is licensed under the same terms as Perl, itself.
Please see http://dev.perl.org/licenses/ for more information.
(c) 2017, Arthur Corliss (corliss@digitalmages.com)
( run in 1.615 second using v1.01-cache-2.11-cpan-39bf76dae61 )