Hydrogen::Code - a standard library for code blocks
This documentation is for Hydrogen::Code 0.016, which is based on Sub::HandlesVia::HandlerLibrary::Code 0.037.
Each function expects a code block as its first argument.
The functions use prototypes, so you don't have to pass a reference.
execute { CODE } @args
Calls the coderef, passing it any arguments.
execute_list { CODE } @args
Calls the coderef, passing it any arguments, and forcing list context. If called in scalar context, returns an arrayref.
execute_scalar { CODE } @args
Calls the coderef, passing it any arguments, and forcing scalar context.
execute_void { CODE } @args
Calls the coderef, passing it any arguments, and forcing void context. Returns undef.
No functions are exported by this module by default. To import them all (this is usually a bad idea), use:
use Hydrogen::Code -all;
To import a particular function, use:
use Hydrogen::Code 'execute_scalar';
To rename functions:
use Hydrogen::Code 'execute_scalar' => { -as => 'myfunc' };
On Perl 5.37.2+, you can import lexically:
use Hydrogen::Code -lexical, 'execute_scalar';
See Exporter::Tiny::Manual::Importing for more hints on importing.
Please report any bugs to http://github.com/tobyink/p5-hydrogen/issues.
Hydrogen, Hydrogen::Curry::CodeRef, Hydrogen::Topic::CodeRef, Sub::HandlesVia::HandlerLibrary::Code, Sub::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.