line |
stmt |
bran |
cond |
sub |
pod |
time |
code |
1
|
|
|
|
|
|
|
package Moose::Autobox::Number; |
2
|
1
|
|
|
1
|
|
8012
|
use Moose::Role; |
|
0
|
|
|
|
|
|
|
|
0
|
|
|
|
|
|
|
3
|
|
|
|
|
|
|
|
4
|
|
|
|
|
|
|
our $VERSION = '0.15'; |
5
|
|
|
|
|
|
|
|
6
|
|
|
|
|
|
|
with 'Moose::Autobox::Value'; |
7
|
|
|
|
|
|
|
|
8
|
|
|
|
|
|
|
sub to { |
9
|
|
|
|
|
|
|
return [ $_[0] .. $_[1] ] if $_[0] <= $_[1]; |
10
|
|
|
|
|
|
|
return [ reverse $_[1] .. $_[0] ]; |
11
|
|
|
|
|
|
|
} |
12
|
|
|
|
|
|
|
|
13
|
|
|
|
|
|
|
1; |
14
|
|
|
|
|
|
|
|
15
|
|
|
|
|
|
|
__END__ |
16
|
|
|
|
|
|
|
|
17
|
|
|
|
|
|
|
=pod |
18
|
|
|
|
|
|
|
|
19
|
|
|
|
|
|
|
=head1 NAME |
20
|
|
|
|
|
|
|
|
21
|
|
|
|
|
|
|
Moose::Autobox::Number - the Number role |
22
|
|
|
|
|
|
|
|
23
|
|
|
|
|
|
|
=head1 DESCRIPTION |
24
|
|
|
|
|
|
|
|
25
|
|
|
|
|
|
|
This is a role to describes a Numeric value. |
26
|
|
|
|
|
|
|
|
27
|
|
|
|
|
|
|
=head1 METHODS |
28
|
|
|
|
|
|
|
|
29
|
|
|
|
|
|
|
=over 4 |
30
|
|
|
|
|
|
|
|
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 |
35
|
|
|
|
|
|
|
some situations, this method intentionally behaves different from the |
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
|
|
|
|
|
|
|
|
46
|
|
|
|
|
|
|
=item B<meta> |
47
|
|
|
|
|
|
|
|
48
|
|
|
|
|
|
|
=back |
49
|
|
|
|
|
|
|
|
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
|
|
|
|
|
|
|
|
62
|
|
|
|
|
|
|
Copyright 2006-2008 by Infinity Interactive, Inc. |
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
|
|
|
|
|
|
|
|
69
|
|
|
|
|
|
|
=cut |