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