The London Perl and Raku Workshop takes place on 26th Oct 2024. If your company depends on Perl, please consider sponsoring and/or attending.

NAME

Hydrogen::CodeRef - a standard library for coderefs

VERSION

This documentation is for Hydrogen::CodeRef 0.018, which is based on Sub::HandlesVia::HandlerLibrary::Code 0.046.

FUNCTIONS

Each function expects a reference to a sub as its first argument.

execute( $coderef, @args )

Calls the coderef, passing it any arguments.

execute_list( $coderef, @args )

Calls the coderef, passing it any arguments, and forcing list context. If called in scalar context, returns an arrayref.

execute_scalar( $coderef, @args )

Calls the coderef, passing it any arguments, and forcing scalar context.

execute_void( $coderef, @args )

Calls the coderef, passing it any arguments, and forcing void context. Returns undef.

EXPORT

No functions are exported by this module by default. To import them all (this is usually a bad idea), use:

    use Hydrogen::CodeRef -all;

To import a particular function, use:

    use Hydrogen::CodeRef 'execute_scalar';

To rename functions:

    use Hydrogen::CodeRef 'execute_scalar' => { -as => 'myfunc' };

On Perl 5.37.2+, you can import lexically:

    use Hydrogen::CodeRef -lexical, 'execute_scalar';

See Exporter::Tiny::Manual::Importing for more hints on importing.

BUGS

Please report any bugs to http://github.com/tobyink/p5-hydrogen/issues.

SEE ALSO

Hydrogen, Hydrogen::Code, Hydrogen::Curry::CodeRef, Hydrogen::Topic::CodeRef, Sub::HandlesVia::HandlerLibrary::Code, Sub::Util.

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.