XAO::SimpleHash - Simple 2D hash manipulations
use XAO::SimpleHash; my $h=new XAO::SimpleHash a => 11, b => 12, c => 13; $h->put(d => 14); $h->fill(\%config); my @keys=$h->keys;
Base object from which various hash-like containers are derived.
Methods are (alphabetical order, PERL API):
sub contains ($$)
Returns key of the element, containing given text. Case is insignificant in comparision.
If no value found 'undef' is returned.
sub defined ($$)
Boolean method to check if element with given key defined or not. Exactly the same as 'defined ($hash->get($key))'.
sub delete ($$)
Deletes given key from the hash.
sub exists ($$)
Checks if given key exists in the hash or not (regardless of value, which can be undef).
sub fill ($@)
Allows to fill hash with multiple values. Supports variety of argument formats:
$hash->fill(key1 => value1, key2 => value2, ...); $hash->fill({ key1 => value1, key2 => value2, ... }); $hash->fill([ key1 => value1 ], [ key2 => value2 ], ...);
sub get ($$)
Returns element by given key. Usually called as:
$hash->get(key);
Support also available for URI:
$hash->put(/path/to/value);
Note that leading and trailing slashes are optional in URI.
sub getref ($$)
Return reference to the element by given key or 'undef' if such element does not exist.
sub keys ($)
Returns array of keys.
sub new ($;@)
Creates new hash and pre-fills it with given values. Values are in the same format as in fill().
sub put ($$$)
Puts single key-value pair into hash. Usually called as:
$hash->put(key => value);
$hash->put(/path/to/value => value);
sub values ($)
Returns array of values in the same order as $hash->keys returns keys (on non-modified hash).
In addition to normal Perl style API outlined above XAO::SimpleHash allows developer to use Java style API. Here is the mapping between Perl API and Java API:
isSet -- defined containsKey -- exists elements -- values remove -- delete containsValue -- contains
Nothing.
Copyright (c) 1997-2001 XAO Inc.
Authors are Marcos Alves <alves@xao.com>, Bil Drury <bild@xao.com>, Andrew Maltsev <am@xao.com>.
1 POD Error
The following errors were encountered while parsing the POD:
You forgot a '=back' before '=head1'
To install XAO::Base, copy and paste the appropriate command in to your terminal.
cpanm
cpanm XAO::Base
CPAN shell
perl -MCPAN -e shell install XAO::Base
For more information on module installation, please visit the detailed CPAN module installation guide.