line |
stmt |
bran |
cond |
sub |
pod |
time |
code |
1
|
|
|
|
|
|
|
package Moose::Autobox::Number; |
2
|
|
|
|
|
|
|
# ABSTRACT: Moose::Autobox::Number - the Number role |
3
|
14
|
|
|
14
|
|
6157
|
use Moose::Role; |
|
14
|
|
|
|
|
19
|
|
|
14
|
|
|
|
|
88
|
|
4
|
14
|
|
|
14
|
|
52765
|
use namespace::autoclean; |
|
14
|
|
|
|
|
26
|
|
|
14
|
|
|
|
|
146
|
|
5
|
|
|
|
|
|
|
|
6
|
|
|
|
|
|
|
our $VERSION = '0.16'; |
7
|
|
|
|
|
|
|
|
8
|
|
|
|
|
|
|
with 'Moose::Autobox::Value'; |
9
|
|
|
|
|
|
|
|
10
|
|
|
|
|
|
|
sub to { |
11
|
3
|
100
|
|
3
|
1
|
121
|
return [ $_[0] .. $_[1] ] if $_[0] <= $_[1]; |
12
|
1
|
|
|
|
|
7
|
return [ reverse $_[1] .. $_[0] ]; |
13
|
|
|
|
|
|
|
} |
14
|
|
|
|
|
|
|
|
15
|
|
|
|
|
|
|
1; |
16
|
|
|
|
|
|
|
|
17
|
|
|
|
|
|
|
__END__ |
18
|
|
|
|
|
|
|
|
19
|
|
|
|
|
|
|
=pod |
20
|
|
|
|
|
|
|
|
21
|
|
|
|
|
|
|
=encoding UTF-8 |
22
|
|
|
|
|
|
|
|
23
|
|
|
|
|
|
|
=head1 NAME |
24
|
|
|
|
|
|
|
|
25
|
|
|
|
|
|
|
Moose::Autobox::Number - Moose::Autobox::Number - the Number role |
26
|
|
|
|
|
|
|
|
27
|
|
|
|
|
|
|
=head1 VERSION |
28
|
|
|
|
|
|
|
|
29
|
|
|
|
|
|
|
version 0.16 |
30
|
|
|
|
|
|
|
|
31
|
|
|
|
|
|
|
=head1 DESCRIPTION |
32
|
|
|
|
|
|
|
|
33
|
|
|
|
|
|
|
This is a role to describes a Numeric value. |
34
|
|
|
|
|
|
|
|
35
|
|
|
|
|
|
|
=head1 METHODS |
36
|
|
|
|
|
|
|
|
37
|
|
|
|
|
|
|
=over 4 |
38
|
|
|
|
|
|
|
|
39
|
|
|
|
|
|
|
=item C<to> |
40
|
|
|
|
|
|
|
|
41
|
|
|
|
|
|
|
Takes another number as argument and produces an array ranging from |
42
|
|
|
|
|
|
|
the number the method is called on to the number given as argument. In |
43
|
|
|
|
|
|
|
some situations, this method intentionally behaves different from the |
44
|
|
|
|
|
|
|
range operator in perl: |
45
|
|
|
|
|
|
|
|
46
|
|
|
|
|
|
|
$foo = [ 5 .. 1 ]; # $foo is [] |
47
|
|
|
|
|
|
|
|
48
|
|
|
|
|
|
|
$foo = 5->to(1); # $foo is [ 5, 4, 3, 2, 1 ] |
49
|
|
|
|
|
|
|
|
50
|
|
|
|
|
|
|
=back |
51
|
|
|
|
|
|
|
|
52
|
|
|
|
|
|
|
=over 4 |
53
|
|
|
|
|
|
|
|
54
|
|
|
|
|
|
|
=item C<meta> |
55
|
|
|
|
|
|
|
|
56
|
|
|
|
|
|
|
=back |
57
|
|
|
|
|
|
|
|
58
|
|
|
|
|
|
|
=head1 SUPPORT |
59
|
|
|
|
|
|
|
|
60
|
|
|
|
|
|
|
Bugs may be submitted through L<the RT bug tracker|https://rt.cpan.org/Public/Dist/Display.html?Name=Moose-Autobox> |
61
|
|
|
|
|
|
|
(or L<bug-Moose-Autobox@rt.cpan.org|mailto:bug-Moose-Autobox@rt.cpan.org>). |
62
|
|
|
|
|
|
|
|
63
|
|
|
|
|
|
|
There is also a mailing list available for users of this distribution, at |
64
|
|
|
|
|
|
|
L<http://lists.perl.org/list/moose.html>. |
65
|
|
|
|
|
|
|
|
66
|
|
|
|
|
|
|
There is also an irc channel available for users of this distribution, at |
67
|
|
|
|
|
|
|
L<C<#moose> on C<irc.perl.org>|irc://irc.perl.org/#moose>. |
68
|
|
|
|
|
|
|
|
69
|
|
|
|
|
|
|
=head1 AUTHOR |
70
|
|
|
|
|
|
|
|
71
|
|
|
|
|
|
|
Stevan Little <stevan.little@iinteractive.com> |
72
|
|
|
|
|
|
|
|
73
|
|
|
|
|
|
|
=head1 COPYRIGHT AND LICENSE |
74
|
|
|
|
|
|
|
|
75
|
|
|
|
|
|
|
This software is copyright (c) 2006 by Infinity Interactive, Inc. |
76
|
|
|
|
|
|
|
|
77
|
|
|
|
|
|
|
This is free software; you can redistribute it and/or modify it under |
78
|
|
|
|
|
|
|
the same terms as the Perl 5 programming language system itself. |
79
|
|
|
|
|
|
|
|
80
|
|
|
|
|
|
|
=cut |