Commit | Line | Data |
---|---|---|
5f654d8e | 1 | |
2 | package Moose::Autobox; | |
3 | ||
4 | use strict; | |
5 | use warnings; | |
6 | ||
31d40d73 | 7 | use Carp qw(confess); |
5f654d8e | 8 | use Scalar::Util (); |
9 | ||
10 | our $VERSION = '0.01'; | |
11 | ||
6cf5bcf2 | 12 | #sub import { |
13 | # eval q| | |
5f654d8e | 14 | package SCALAR; |
31d40d73 | 15 | |
16 | # NOTE: | |
17 | # this doesnt make sense, but | |
18 | # I need to prevent Moose from | |
19 | # assiging to @ISA | |
20 | use base 'Moose::Autobox'; | |
21 | ||
5f654d8e | 22 | use Moose; |
23 | with 'Moose::Autobox::Scalar'; | |
24 | ||
31d40d73 | 25 | *does = \&Moose::Object::does; |
26 | ||
5f654d8e | 27 | package ARRAY; |
31d40d73 | 28 | use base 'Moose::Autobox'; |
5f654d8e | 29 | use Moose; |
30 | with 'Moose::Autobox::Array'; | |
31 | ||
31d40d73 | 32 | *does = \&Moose::Object::does; |
33 | ||
5f654d8e | 34 | package HASH; |
31d40d73 | 35 | use base 'Moose::Autobox'; |
5f654d8e | 36 | use Moose; |
37 | with 'Moose::Autobox::Hash'; | |
38 | ||
31d40d73 | 39 | *does = \&Moose::Object::does; |
40 | ||
5f654d8e | 41 | package CODE; |
31d40d73 | 42 | use base 'Moose::Autobox'; |
5f654d8e | 43 | use Moose; |
31d40d73 | 44 | with 'Moose::Autobox::Code'; |
45 | ||
46 | *does = \&Moose::Object::does; | |
47 | ||
6cf5bcf2 | 48 | # |; |
49 | # confess 'Could not create autobox packages because - ' . $@ if $@; | |
50 | #} | |
5f654d8e | 51 | |
52 | 1; | |
53 | ||
54 | __END__ | |
55 | ||
56 | =pod | |
57 | ||
58 | =head1 NAME | |
59 | ||
60 | Moose::Autobox - autoboxed for her pleasure | |
61 | ||
62 | =head1 SYNOPOSIS | |
63 | ||
39894c95 | 64 | use Moose::Autobox; |
65 | use autobox; | |
31d40d73 | 66 | |
67 | 'Print squares from 1 to 10'->print; | |
68 | [ 1 .. 10 ]->map(sub { $_ * $_ })->join(', ')->print; | |
39894c95 | 69 | |
5f654d8e | 70 | =head1 DESCRIPTION |
71 | ||
39894c95 | 72 | =head1 ROLES |
73 | ||
31d40d73 | 74 | Item | |
75 | Undef | | |
76 | Defined | | |
77 | Scalar* <-|- String, Number <--+ | |
78 | Ref | |-- Value | |
79 | Array* <-|- List <------------+ | |
80 | Hash* | | |
81 | Code* | | |
82 | ||
39894c95 | 83 | * indicates actual autoboxed types |
31d40d73 | 84 | |
85 | =head1 NOTES | |
86 | ||
87 | - String, Number & List are currently the only Values. | |
88 | ||
89 | - Indexed is pretty much an interface, we probably will | |
90 | need more of these (see Smalltalk Collection Trait | |
91 | Refactoring) | |
92 | ||
5f654d8e | 93 | =head1 BUGS |
94 | ||
95 | All complex software has bugs lurking in it, and this module is no | |
96 | exception. If you find a bug please either email me, or add the bug | |
97 | to cpan-RT. | |
98 | ||
99 | =head1 AUTHOR | |
100 | ||
101 | Stevan Little E<lt>stevan@iinteractive.comE<gt> | |
102 | ||
103 | =head1 COPYRIGHT AND LICENSE | |
104 | ||
105 | Copyright 2006 by Infinity Interactive, Inc. | |
106 | ||
107 | L<http://www.iinteractive.com> | |
108 | ||
109 | This library is free software; you can redistribute it and/or modify | |
110 | it under the same terms as Perl itself. | |
111 | ||
5f654d8e | 112 | =cut |