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 Using the $_ topic variable: use feature 'say'; use Hydrogen::Topic::HashRef qw( get set ); local $_ = {}; set( Alice => 123 ); set( Bob => 456 ); say $_->{Alice}; ## ==> 123 say get( '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. RATIONALE Whydrogen? You can make a coderef pointing to `\&Hydrogen::Number::add` but you can't make a coderef pointing to Perl's `+=` operator! If you are implementing a scripting language or DSL which needs to provide a standard library of builtin functions, then Hydrogen may be a good place to start. THE HYDROGEN LIBRARY * Hydrogen::ArrayRef * Hydrogen::Bool * Hydrogen::CodeRef * Hydrogen::Counter * Hydrogen::HashRef * Hydrogen::Number * Hydrogen::Scalar * Hydrogen::String Prototyped Functions * Hydrogen::Array * Hydrogen::Code * Hydrogen::Hash Curry Functions * Hydrogen::Curry::ArrayRef * Hydrogen::Curry::Bool * Hydrogen::Curry::CodeRef * Hydrogen::Curry::Counter * Hydrogen::Curry::HashRef * Hydrogen::Curry::Number * Hydrogen::Curry::Scalar * Hydrogen::Curry::String Topicalized Functions * Hydrogen::Topic::ArrayRef * Hydrogen::Topic::Bool * Hydrogen::Topic::CodeRef * Hydrogen::Topic::Counter * Hydrogen::Topic::HashRef * Hydrogen::Topic::Number * Hydrogen::Topic::Scalar * Hydrogen::Topic::String BONUS FUNCTIONS Hydrogen uses the following functions internally, but they may also be useful to you. `Hydrogen::croak( $message, @args? )` Acts like `croak` from Carp, but if @args is provided, will `sprintf` first. If @args contains references, those will be dumped using Data::Dumper. `Hydrogen::fc( $string? )` Acts like `CORE::fc` if that function is available, and `CORE::lc` otherwise. If no $string is provided, operates on $_. DEPENDENCIES Hydrogen requires Perl 5.8.1 or above. Hydrogen requires the modules Carp, Data::Dumper, List::Util, and Scalar::Util, all of which normally come with Perl. Hydrogen needs at least version 1.54 of List::Util; Perl versions older than 5.32.0 will be distributed with older versions of List::Util, but upgrades to the module can be found on the CPAN. Hydrogen also requires the module Exporter::Shiny which can be found on the CPAN. Hydrogen's test suite requires the module Test2::V0 which can be found on the CPAN. BUGS Please report any bugs to . 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 . 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.