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