Data::...Counter(3pm)

πŸ’– Data::Perl::Role::Counter β€” the girlies' guide πŸ’–

ok so bestie, you're reading the manual page for Data::...Counter(3pm), which is the Perl doc for Data::Perl::Role::Counter β€” a wrapping class for a simple numeric counter. that's the whole vibe. a number that goes up, a number that goes down, a number that goes back to zero. iconic behaviour honestly. ✨


🌸 VERSION 🌸

version 0.002011</purpose>

(purple tags: use <purple> only. Let me redo.)

🌸 VERSION 🌸

version 0.002011

like, that's the version. lowkey important, no cap.


πŸŽ€ SYNOPSIS πŸŽ€

here's the whole energy in four lines, fr fr:

use Data::Perl qw/counter/;

my $c = counter(4);

$c->inc;   # $c == 5

$c->reset; # $c == 0

see how it starts at 4, hits 5, and then just casually resets to 0? that's the arc. that's the character development. πŸ’…


πŸ¦‹ DESCRIPTION πŸ¦‹

This class provides a wrapper and methods for a simple numeric counter.

that's it. that's the description. it wraps a number and gives you methods to mess with it. simple, clean, does exactly what it says on the tin. not every module needs to be a whole production. 🫢


✨ PROVIDED METHODS ✨

the main characters, in order:

  • new($value) β€” Constructs a new Data::Perl::Collection::Counter object initialized with the passed in value, and returns it. give it a number, get a whole object back. glow-up.
  • set($value) β€” Sets the counter to the specified value and returns the new value. This method requires a single argument. so like, you have to hand it a value. it's not optional, bestie. one argument, that's the rule. βœ‹
  • inc β€” Increases the attribute value by the amount of the argument, or by 1 if no argument is given. This method returns the new value. This method accepts a single argument. πŸ†™
  • inc($arg) β€” same thing as above but now you're giving it the argument: increases the attribute value by the amount of the argument, or by 1 if no argument is given. This method returns the new value. This method accepts a single argument.
  • dec β€” Decreases the attribute value by the amount of the argument, or by 1 if no argument is given. This method returns the new value. This method accepts a single argument. πŸ“‰
  • dec($arg) β€” Decreases the attribute value by the amount of the argument, or by 1 if no argument is given. This method returns the new value. This method accepts a single argument.
  • reset β€” Resets the value stored in this slot to its default value, and returns the new value. the "okay we're starting over, fresh slate, clean girl era" method. 🧚
ngl the inc/dec pairs are listed as separate entries up there because that's literally how the page does it β€” one without an arg, one with. same method, two signatures. iykyk. don't come for me, i'm just the messenger. 😭

πŸ”₯ SEE ALSO πŸ”₯

go read these next, bestie, they're the whole friend group:

  • Data::Perl
  • MooX::HandlesVia

πŸ‘‘ AUTHOR πŸ‘‘

Matthew Phillips <mattp@cpan.org>

like, credit where credit is due. slay. πŸ’œ


This software is copyright (c) 2020 by Matthew Phillips <mattp@cpan.org>.

This is free software; you can redistribute it and/or modify it under the same terms as the Perl 5 programming language system itself.

so yeah β€” free to use, free to share, same terms as Perl 5 itself. go off, king. πŸŽ€


and that's the whole page, bestie!! sign-off time: this was written for perl v5.36.0, dated 2022-10-16, and it lives at Data::...Counter(3pm) in the User Contributed Perl Documentation section. go forth and count. β­πŸŒΈπŸ’…

πŸ“¦ where this page comes from