MooseX...Number(3pm)

๐Ÿ“ฆ
version 0.25 ยท 6 versions
, in debian bookworm, debian trixie, ubuntu noble, ubuntu resolute, ubuntu stonking

okay bestie, pull up a chair ๐Ÿซถ this is the manual page for MooseX::AttributeHelpers::Number, straight out of the User Contributed Perl Documentation collection. It's short, it's sweet, it does math, and honestly? It ate. Let's go. โœจ


๐ŸŒธ NAME ๐ŸŒธ

MooseX::AttributeHelpers::Number โ€” numerical attribute type. That's it, that's the whole vibe. ๐Ÿ’…


๐ŸŽ€ VERSION ๐ŸŽ€

version 0.25 โ€” yes queen, we're on 0.25, no cap.


โœจ SYNOPSIS โœจ

Here's the whole thing in action, bestie. Copy it, it's perfect, it's iconic:

package Real;
use Moose;
use MooseX::AttributeHelpers;

has 'integer' => (
    metaclass => 'Number',
    is        => 'ro',
    isa       => 'Int',
    default   => sub { 5 },
    provides  => {
        set => 'set',
        add => 'add',
        sub => 'sub',
        mul => 'mul',
        div => 'div',
        mod => 'mod',
        abs => 'abs',
    }
);

my $real = Real->new();
$real->add(5); # same as $real->integer($real->integer + 5);
$real->sub(2); # same as $real->integer($real->integer - 2);

Look at those comments doing the explaining for me, we love a self-aware snippet. ๐Ÿฆ‹


๐Ÿ’œ DESCRIPTION ๐Ÿ’œ

So what even is this? It gives you a simple numeric attribute that comes with most of the basic math operations pre-installed. Like, it's giving calculator but make it Moose. ๐Ÿงฎโœจ That's the whole description, periodt.


๐Ÿ‘‘ NAME ๐Ÿ‘‘ (yes, again, not a typo, bestie ๐Ÿ˜ญ)

MooseX::AttributeHelpers::Number

This page literally has two NAME sections. I don't make the rules, I just deliver them faithfully. ๐Ÿ’–


๐Ÿ”ฅ METHODS ๐Ÿ”ฅ

The methods this thing ships with:

  • meta
  • helper_type
  • method_constructors

ngl the original just lists them with zero explanation, so that's what we're doing too. Mysterious. Main character energy. ๐Ÿ™ˆ


๐Ÿ’… PROVIDED METHODS ๐Ÿ’…

๐Ÿšจ REAL TALK, READ THIS TWICE: every single one of these methods does an in place modification of the value stored in the attribute. In. Place. Not a copy. Not a new object. The actual value. So act accordingly. ๐Ÿ’€
  • set ($value) โ€” the alternate way to set the value. Like, another route to the same destination. ๐Ÿ›ฃ๏ธ
  • add ($value) โ€” adds the current value of the attribute to $value. Math o'clock. โž•
  • sub ($value) โ€” subtracts the current value of the attribute to $value. Subtraction, bestie. โž–
  • mul ($value) โ€” multiplies the current value of the attribute to $value. Multiplying, slay. โœ–๏ธ
  • div ($value) โ€” divides the current value of the attribute to $value. Division, iconic. โž—
  • mod ($value) โ€” modulus the current value of the attribute to $value. The remainder of the bunch. ๐Ÿ”ข
  • abs โ€” sets the current value of the attribute to its absolute value. Always positive, always glowing, we love that for it. โญ

๐ŸŒˆ SUPPORT ๐ŸŒˆ

Got beef? Found a bug? Same thing, honestly. ๐Ÿ› Here's where to go:


๐Ÿฆ‹ AUTHOR ๐Ÿฆ‹

Shoutout to the legends who made this:

  • Stevan Little <stevan@iinteractive.com>
  • Robert Boone

Kings. ๐Ÿ‘‘


This software is copyright (c) 2007 by Stevan Little and Infinity Interactive, Inc.

It's free software, bestie โ€” you can redistribute it and/or modify it under the same terms as the Perl 5 programming language system itself. Go wild, just keep it legal. ๐Ÿ’–


and that's the whole page, bestie!! ๐ŸŽ€ This was pulled from perl v5.34.0, dated 2022-06-15, filed under MooseX...Number(3pm). Mwah. Go do some math. ๐Ÿ’…โœจ๐Ÿฆ‹

๐Ÿ“ฆ where this page comes from