Hydrogen::Topic::HashRef - functions from Hydrogen::HashRef applied to $_
$_
This documentation is for Hydrogen::Topic::HashRef 0.016, which is based on Sub::HandlesVia::HandlerLibrary::Hash 0.037.
Each function implicitly operates on $_, expecting it to be a reference to a hash.
accessor( $key, $value? )
Operates on $_, which must be a reference to a hash.
Arguments: Str, Optional[Any].
Acts like get if given one argument, or set if given two arguments.
get
set
all()
Returns the hash in list context.
clear()
Empties the hash.
count()
Returns the number of keys in the hash.
defined( $key )
Arguments: Str.
Indicates whether a value exists and is defined in the hashref by its key.
delete( $key )
Removes a value from the hashref by its key.
delete_where( $match )
Arguments: CodeRef|RegexpRef.
Removes values from the hashref by matching keys against a coderef or regexp.
elements()
exists( $key )
Indicates whether a value exists in the hashref by its key.
for_each_key( $coderef )
Arguments: CodeRef.
Function which calls the coderef for each key in the hash, passing just the key to the coderef.
for_each_pair( $coderef )
Function which calls the coderef for each key in the hash, passing the key and value to the coderef.
for_each_value( $coderef )
Function which calls the coderef for each value in the hash, passing just the value to the coderef.
get( $key )
Returns a value from the hashref by its key.
is_empty()
Returns true iff there are no keys in the hash.
keys()
Returns the list of keys in the hash.
kv()
Returns a list of arrayrefs, where each arrayref is a key-value pair.
reset()
Resets the original value to its default value, or an empty hashref if it has no default.
set( $key, $value, ... )
Given a key and value, adds the key to the hashref with the given value.
shallow_clone()
Creates a new hashref with the same keys and values as the original.
sorted_keys()
Returns an alphabetically sorted list of keys in the hash.
values()
Returns the list of values in the hash.
No functions are exported by this module by default. To import them all (this is usually a bad idea), use:
use Hydrogen::Topic::HashRef -all;
To import a particular function, use:
use Hydrogen::Topic::HashRef 'clear';
To rename functions:
use Hydrogen::Topic::HashRef 'clear' => { -as => 'myfunc' };
On Perl 5.37.2+, you can import lexically:
use Hydrogen::Topic::HashRef -lexical, 'clear';
See Exporter::Tiny::Manual::Importing for more hints on importing.
Please report any bugs to http://github.com/tobyink/p5-hydrogen/issues.
Hydrogen, Hydrogen::HashRef, Hydrogen::Hash, Hydrogen::Curry::HashRef, Sub::HandlesVia::HandlerLibrary::Hash, Hash::Util.
Toby Inkster <tobyink@cpan.org>.
This software is copyright (c) 2022 by Toby Inkster.
This is free software; you can redistribute it and/or modify it under the same terms as the Perl 5 programming language system itself.
THIS PACKAGE IS PROVIDED "AS IS" AND WITHOUT ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, WITHOUT LIMITATION, THE IMPLIED WARRANTIES OF MERCHANTIBILITY AND FITNESS FOR A PARTICULAR PURPOSE.
To install Hydrogen, copy and paste the appropriate command in to your terminal.
cpanm
cpanm Hydrogen
CPAN shell
perl -MCPAN -e shell install Hydrogen
For more information on module installation, please visit the detailed CPAN module installation guide.