MooseX...:Number(3pm)
๐ MooseX::AttributeHelpers::Trait::Number ๐
okay bestie, gather round, we're doing a User Contributed Perl Documentation moment. this one's from the MooseX...:Number(3pm) page and it's literally the cutest little numeric attribute you ever met. no cap.
โจ NAME โจ
MooseX::AttributeHelpers::Trait::Number โ it's giving... a simple numeric attribute ๐งฎโจ
๐ธ VERSION ๐ธ
version 0.25 โ yeah she's been around, she's vintage, she's iconic ๐
๐ SYNOPSIS ๐
okay so here's the whole vibe, copy-paste this into your lil heart:
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);
like... look at her go. the metaclass => 'Number', the provides hash handing out all those math methods like friendship bracelets ๐ซถ. main character behavior fr fr.
๐ DESCRIPTION ๐
So basically this trait gives you a simple numeric attribute, and she supports most of the basic math operations. that's it, that's the whole pitch. lowkey perfect, highkey useful. ๐ฆ
๐ METHODS ๐
the whole squad, no notes:
metahelper_typemethod_constructors
โญ PROVIDED METHODS โญ
๐จ important bestie alert ๐จ all of these methods do in place modification of the value stored in the attribute. like, they're changing the actual value, not handing you back a copy. so don't be surprised, okay? ๐ญ
set ($value)โ an alternate way to set the value. the side door to the same house ๐ชadd ($value)โ adds the current value of the attribute to$value. math but make it cute โsub ($value)โ subtracts the current value of the attribute to$value. (yes, "to". we're keeping the original wording, don't come for me ๐) โmul ($value)โ multiplies the current value of the attribute to$value. times tables but slay โ๏ธdiv ($value)โ divides the current value of the attribute to$value. split it like a friend group in a group project โmod ($value)โ modulus the current value of the attribute to$value. the remainder, the leftovers, the crumbs ๐absโ sets the current value of the attribute to its absolute value. glow up but for negatives โจ
๐ซถ SUPPORT ๐ซถ
got bugs? not the vibe, but okay, here's where to go:
- Bugs may be submitted through the RT bug tracker: <https://rt.cpan.org/Public/Dist/Display.html?Name=MooseX-AttributeHelpers> โ or email
bug-MooseX-AttributeHelpers@rt.cpan.org๐ - There is also a mailing list available for users of this distribution, at <http://lists.perl.org/list/moose.html> ๐ฌ
- There is also an irc channel available for users of this distribution, at
#mooseonirc.perl.orgโ <irc://irc.perl.org/#moose> ๐ฌ
come hang, we don't bite, iykyk ๐
๐ AUTHOR ๐
- Stevan Little
<stevan@iinteractive.com> - Robert Boone
legends, honestly. periodt. ๐
๐ COPYRIGHT AND LICENSE ๐
This software is copyright (c) 2007 by Stevan Little and Infinity Interactive, Inc.
This is free software; you can redistribute it and/or modify it under the same terms as the Perl 5 programming language system itself. ๐
and that's the whole page bestie, you ate it ๐โจ
this lil cutie was served to you by perl v5.34.0, dated 2022-06-15, straight from the MooseX...:Number(3pm) manual โ mwah, go write some numbers, love u ๐๐ฆ๐
๐ฆ where this page comes from
- debian bookworm: libmoosex-attributehelpers-perl 0.25-2 ยท Artistic-1.0-Perl OR GPL-1.0-or-later
- debian trixie: libmoosex-attributehelpers-perl 0.25-2 ยท Artistic-1.0-Perl OR GPL-1.0-or-later
- ubuntu noble: libmoosex-attributehelpers-perl 0.25-2 ยท Artistic-1.0-Perl OR GPL-1.0-or-later
- ubuntu resolute: libmoosex-attributehelpers-perl 0.25-2 ยท Artistic-1.0-Perl OR GPL-1.0-or-later
- ubuntu stonking: libmoosex-attributehelpers-perl 0.25-2 ยท Artistic-1.0-Perl OR GPL-1.0-or-later
- ๐ girlified by deepseek-ai/DeepSeek-V4.1-Flash on : a language model's rewrite of the original, under its terms