Moose::Autobox::Number - the Number role


Moose-Autobox documentation Contained in the Moose-Autobox distribution.

Index


Code Index:

NAME

Top

Moose::Autobox::Number - the Number role

DESCRIPTION

Top

This is a role to describes a Numeric value.

METHODS

Top

to

Takes another number as argument and produces an array ranging from the number the method is called on to the number given as argument. In some situations, this method intentionally behaves different from the range operator in perl:

  $foo = [ 5 .. 1 ]; # $foo is []

  $foo = 5->to(1);   # $foo is [ 5, 4, 3, 2, 1 ]

meta

BUGS

Top

All complex software has bugs lurking in it, and this module is no exception. If you find a bug please either email me, or add the bug to cpan-RT.

AUTHOR

Top

Stevan Little <stevan@iinteractive.com>

COPYRIGHT AND LICENSE

Top


Moose-Autobox documentation Contained in the Moose-Autobox distribution.

package Moose::Autobox::Number;
use Moose::Role;

our $VERSION = '0.11';

with 'Moose::Autobox::Value';

sub to {
    return [ $_[0] .. $_[1] ] if $_[0] <= $_[1];
    return [ reverse $_[1] .. $_[0] ];
}

1;

__END__