NAKAGAWA Masaki > MouseX-AttributeHelpers-0.07 > MouseX::AttributeHelpers::Number

Download:
MouseX-AttributeHelpers-0.07.tar.gz

Dependencies

Annotate this POD

CPAN RT

Open  0
View/Report Bugs
Source  

NAME ^

MouseX::AttributeHelpers::Number

SYNOPSIS ^

    package Real;
    use Mouse;
    use MouseX::AttributeHelpers;
  
    has 'integer' => (
        metaclass => 'Number',
        is        => 'rw',
        isa       => 'Int',
        default   => 5,
        provides  => {
            set => 'set',
            add => 'add',
            sub => 'sub',
            mul => 'mul',
            div => 'div',
            mod => 'mod',
            abs => 'abs',
        },
    );

    package main;
    my $real = Real->new;

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

DESCRIPTION ^

This provides a simple numeric attribute, which supports most of the basic math operations.

PROVIDERS ^

set

add

sub

mul

div

mod

abs

METHODS ^

method_constructors

helper_type

AUTHOR ^

NAKAGAWA Masaki <masaki@cpan.org>

LICENSE ^

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

SEE ALSO ^

MouseX::AttributeHelpers, MouseX::AttributeHelpers::Base

syntax highlighting: