Data::...Number(3pm)

✨ NAME ✨

Data::Perl::Role::Number β€” it's a wrapping class for Perl scalar numbers, bestie πŸ’– (the header up top says Data::...Number(3pm) and this whole thing lives in the User Contributed Perl Documentation, iykyk)

🌸 VERSION 🌸

version 0.002011 β€” yes she's got a version number, and she's proud of it ✨

πŸ¦‹ SYNOPSIS πŸ¦‹

use Data::Perl qw/number/;

my $num = number(123);

$num->add(5); # $num == 128

$num->div(2); # $num == 64

like literally that's it, so clean, so demure πŸŽ€

πŸ’… DESCRIPTION πŸ’…

This class provides a wrapper and methods for interacting with scalar strings. No cap. 🫢

πŸ‘‘ PROVIDED METHODS πŸ‘‘

okay so here's the tea β˜• β€” all of these methods modify the attribute's value in place. All methods return the new value. Every single one. Immediately. In place. And then hands you back the fresh value like a lil gift 🎁

  • new($value) β€” constructs a new Data::Perl::Collection::Number object initialized with the passed in value, and returns it. Baby's first number wrapper 🌱
  • add($value) β€” adds the current value of the attribute to $value.
  • sub($value) β€” subtracts $value from the current value of the attribute.
  • mul($value) β€” multiplies the current value of the attribute by $value.
  • div($value) β€” divides the current value of the attribute by $value.
  • mod($value) β€” returns the current value of the attribute modulo $value.
  • abs β€” sets the current value of the attribute to its absolute value. no args, she just does the thing ✨

🌈 SEE ALSO 🌈

  • Data::Perl
  • MooX::HandlesVia

go read those too, they're part of the lore πŸ“š

πŸ’œ AUTHOR πŸ’œ

Matthew Phillips <mattp@cpan.org> β€” ty king πŸ‘‘

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. periodt πŸ’…


and that's the whole page bestie, no crumbs left 🧚 β€” this one landed as perl v5.36.0 on 2022-10-16, mwah, slay, go write something cute πŸ’–βœ¨

πŸ“¦ where this page comes from