NAME

Hydrogen::Counter - a standard library for integer counters

VERSION

This documentation is for Hydrogen::Counter 0.020000, which is based on Sub::HandlesVia::HandlerLibrary::Counter 0.046.

FUNCTIONS

Each function expects an integer as its first argument.

dec( $counter, $amount? )

Additional arguments: Optional[Int].

Decrements the counter by $amount, or by 1 if no value is given.

inc( $counter, $amount? )

Additional arguments: Optional[Int].

Increments the counter by $amount, or by 1 if no value is given.

reset( $counter )

Sets the counter to its default value, or 0 if it has no default.

set( $counter, $value )

Additional arguments: Int.

Sets the counter to the given value.

EXPORT

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

use Hydrogen::Counter -all;

To import a particular function, use:

use Hydrogen::Counter 'reset';

To rename functions:

use Hydrogen::Counter 'reset' => { -as => 'myfunc' };

On Perl 5.37.2+ (or if Lexical::Sub is installed) you can import lexically:

use Hydrogen::Counter -lexical, 'reset';

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::Curry::Counter, Hydrogen::Topic::Counter, Sub::HandlesVia::HandlerLibrary::Counter.

AUTHOR

Toby Inkster <tobyink@cpan.org>.

COPYRIGHT AND LICENCE

This software is copyright (c) 2022-2023 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.