e3c88ed01d50653979f8e16e83ae709a3851292c
[gitmo/Moose-Autobox.git] / lib / Moose / Autobox / Value.pm
1 package Moose::Autobox::Value;     
2 use Moose::Role 'with', 'requires';
3
4 our $VERSION = '0.01';
5
6 with 'Moose::Autobox::Defined';
7
8 requires 'print';
9
10 sub do { 
11     my ($self, $block) = @_;
12     local $_ = $self;
13     $block->($self);
14 }
15
16 1;
17 __END__
18
19 =pod
20
21 =head1 NAME 
22
23 Moose::Autobox::Value - the Value role
24
25 =head1 SYNOPOSIS
26
27   use Moose::Autobox;
28   use autobox;
29   
30   5->print; # prints 5
31   
32   # excute a sub on the value
33   10->do(sub { $_ + 15 })->print; # prints 25
34
35 =head1 DESCRIPTION
36
37 =head1 BUGS
38
39 All complex software has bugs lurking in it, and this module is no 
40 exception. If you find a bug please either email me, or add the bug
41 to cpan-RT.
42
43 =head1 AUTHOR
44
45 Stevan Little E<lt>stevan@iinteractive.comE<gt>
46
47 =head1 COPYRIGHT AND LICENSE
48
49 Copyright 2006 by Infinity Interactive, Inc.
50
51 L<http://www.iinteractive.com>
52
53 This library is free software; you can redistribute it and/or modify
54 it under the same terms as Perl itself.
55
56 =cut