line |
stmt |
bran |
cond |
sub |
pod |
time |
code |
1
|
|
|
|
|
|
|
package Moose::Autobox::Value; |
2
|
1
|
|
|
1
|
|
1661
|
use Moose::Role 'with'; |
|
0
|
|
|
|
|
|
|
|
0
|
|
|
|
|
|
|
3
|
|
|
|
|
|
|
|
4
|
|
|
|
|
|
|
our $VERSION = '0.15'; |
5
|
|
|
|
|
|
|
|
6
|
|
|
|
|
|
|
with 'Moose::Autobox::Defined'; |
7
|
|
|
|
|
|
|
|
8
|
|
|
|
|
|
|
sub do { |
9
|
|
|
|
|
|
|
my ($self, $block) = @_; |
10
|
|
|
|
|
|
|
local $_ = $self; |
11
|
|
|
|
|
|
|
$block->($self); |
12
|
|
|
|
|
|
|
} |
13
|
|
|
|
|
|
|
|
14
|
|
|
|
|
|
|
1; |
15
|
|
|
|
|
|
|
__END__ |
16
|
|
|
|
|
|
|
|
17
|
|
|
|
|
|
|
=pod |
18
|
|
|
|
|
|
|
|
19
|
|
|
|
|
|
|
=head1 NAME |
20
|
|
|
|
|
|
|
|
21
|
|
|
|
|
|
|
Moose::Autobox::Value - the Value role |
22
|
|
|
|
|
|
|
|
23
|
|
|
|
|
|
|
=head1 SYNOPOSIS |
24
|
|
|
|
|
|
|
|
25
|
|
|
|
|
|
|
use Moose::Autobox; |
26
|
|
|
|
|
|
|
|
27
|
|
|
|
|
|
|
# execute a sub on the value |
28
|
|
|
|
|
|
|
print 10->do(sub { $_ * $_ }); # prints 100 |
29
|
|
|
|
|
|
|
|
30
|
|
|
|
|
|
|
=head1 DESCRIPTION |
31
|
|
|
|
|
|
|
|
32
|
|
|
|
|
|
|
This is a role to describes a defined (non-reference) Perl value. |
33
|
|
|
|
|
|
|
|
34
|
|
|
|
|
|
|
=head1 METHODS |
35
|
|
|
|
|
|
|
|
36
|
|
|
|
|
|
|
=over 4 |
37
|
|
|
|
|
|
|
|
38
|
|
|
|
|
|
|
=item B<meta> |
39
|
|
|
|
|
|
|
|
40
|
|
|
|
|
|
|
=item B<do (\&block)> |
41
|
|
|
|
|
|
|
|
42
|
|
|
|
|
|
|
=back |
43
|
|
|
|
|
|
|
|
44
|
|
|
|
|
|
|
=head1 BUGS |
45
|
|
|
|
|
|
|
|
46
|
|
|
|
|
|
|
All complex software has bugs lurking in it, and this module is no |
47
|
|
|
|
|
|
|
exception. If you find a bug please either email me, or add the bug |
48
|
|
|
|
|
|
|
to cpan-RT. |
49
|
|
|
|
|
|
|
|
50
|
|
|
|
|
|
|
=head1 AUTHOR |
51
|
|
|
|
|
|
|
|
52
|
|
|
|
|
|
|
Stevan Little E<lt>stevan@iinteractive.comE<gt> |
53
|
|
|
|
|
|
|
|
54
|
|
|
|
|
|
|
=head1 COPYRIGHT AND LICENSE |
55
|
|
|
|
|
|
|
|
56
|
|
|
|
|
|
|
Copyright 2006-2008 by Infinity Interactive, Inc. |
57
|
|
|
|
|
|
|
|
58
|
|
|
|
|
|
|
L<http://www.iinteractive.com> |
59
|
|
|
|
|
|
|
|
60
|
|
|
|
|
|
|
This library is free software; you can redistribute it and/or modify |
61
|
|
|
|
|
|
|
it under the same terms as Perl itself. |
62
|
|
|
|
|
|
|
|
63
|
|
|
|
|
|
|
=cut |