NAME
Hydrogen - utilities for the simplest elements of Perl
SYNOPSIS
Normal version of the function:
use feature 'say';
use Hydrogen::HashRef { prefix => 'hhr_' }, qw( get set );
my %hash;
hhr_set( \%hash, Alice => 123 );
hhr_set( \%hash, Bob => 456 );
say $hash{Alice}; ## ==> 123
say hhr_get( \%hash, 'Bob' ); ## ==> 456
Version of the function which uses prototypes:
use feature 'say';
use Hydrogen::Hash { prefix => 'hh_' }, qw( get set );
my %hash;
hh_set( %hash, Alice => 123 );
hh_set( %hash, Bob => 456 );
say $hash{Alice}; ## ==> 123
say hh_get( %hash, 'Bob' ); ## ==> 456
Currying:
use feature 'say';
use Hydrogen::Curry::HashRef qw( curry_get curry_set );
my %hash;
my $setter = curry_set( \%hash );
my $getter = curry_get( \%hash );
$setter->( Alice => 123 );
$setter->( Bob => 456 );
say $hash{Alice}; ## ==> 123
say $getter->( 'Bob' ); ## ==> 456
DESCRIPTION
Hydrogen provides a standard library for doing really simple things in Perl. And I mean really simple things.
Things which are often Perl builtin functions, operators, and even just part of Perl syntax like accessing keys within hashes.
What is the point in having functions to do these simple things? Well, you can make a coderef pointing to \&Hydrogen::Number::add
but you can't make a coderef pointing to Perl's +=
operator!
THE HYDROGEN LIBRARY
BUGS
Please report any bugs to http://github.com/tobyink/p5-hydrogen/issues.
SEE ALSO
This standard library is autogenerated from Sub::HandlesVia which provides the same functionality as methods which objects can delegate to attributes.
AUTHOR
Toby Inkster <tobyink@cpan.org>.
COPYRIGHT AND LICENCE
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.
DISCLAIMER OF WARRANTIES
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.