Commit | Line | Data |
31d40d73 |
1 | package Moose::Autobox::Number; |
2 | use Moose::Role; |
3 | |
f0f5341b |
4 | our $VERSION = '0.10'; |
31d40d73 |
5 | |
6 | with 'Moose::Autobox::Value'; |
f0f5341b |
7 | |
8 | sub to { |
9 | return [ $_[0] .. $_[1] ] if $_[0] <= $_[1]; |
10 | return [ reverse $_[1] .. $_[0] ]; |
11 | } |
12 | |
31d40d73 |
13 | 1; |
14 | |
15 | __END__ |
16 | |
17 | =pod |
18 | |
19 | =head1 NAME |
20 | |
21 | Moose::Autobox::Number - the Number role |
22 | |
31d40d73 |
23 | =head1 DESCRIPTION |
24 | |
8937074a |
25 | This is a role to describes a Numeric value. |
26 | |
260cc81f |
27 | =head1 METHODS |
28 | |
29 | =over 4 |
30 | |
f0f5341b |
31 | =item B<to> |
32 | |
33 | Takes another number as argument and produces an array ranging from |
34 | the number the method is called on to the number given as argument. In |
f1f749bc |
35 | some situations, this method intentionally behaves different from the |
f0f5341b |
36 | range operator in perl: |
37 | |
38 | $foo = [ 5 .. 1 ]; # $foo is [] |
39 | |
40 | $foo = 5->to(1); # $foo is [ 5, 4, 3, 2, 1 ] |
41 | |
42 | =back |
43 | |
44 | =over 4 |
45 | |
260cc81f |
46 | =item B<meta> |
47 | |
48 | =back |
49 | |
31d40d73 |
50 | =head1 BUGS |
51 | |
52 | All complex software has bugs lurking in it, and this module is no |
53 | exception. If you find a bug please either email me, or add the bug |
54 | to cpan-RT. |
55 | |
56 | =head1 AUTHOR |
57 | |
58 | Stevan Little E<lt>stevan@iinteractive.comE<gt> |
59 | |
60 | =head1 COPYRIGHT AND LICENSE |
61 | |
ea4e64bf |
62 | Copyright 2006-2008 by Infinity Interactive, Inc. |
31d40d73 |
63 | |
64 | L<http://www.iinteractive.com> |
65 | |
66 | This library is free software; you can redistribute it and/or modify |
67 | it under the same terms as Perl itself. |
68 | |
caac33a3 |
69 | =cut |