foo
[gitmo/Moose-Autobox.git] / lib / Moose / Autobox.pm
index 7b9838f..42e0dd6 100644 (file)
@@ -4,30 +4,50 @@ package Moose::Autobox;
 use strict;
 use warnings;
 
-use Moose        ();
+use Carp        qw(confess);
 use Scalar::Util ();
 
 our $VERSION = '0.01';
             
-sub import {
-    eval q|
+#sub import {
+#    eval q|
 package SCALAR;
+
+# NOTE:
+# this doesnt make sense, but 
+# I need to prevent Moose from 
+# assiging to @ISA
+use base 'Moose::Autobox';
+
 use Moose;
 with 'Moose::Autobox::Scalar';
 
+*does = \&Moose::Object::does;
+
 package ARRAY;
+use base 'Moose::Autobox';
 use Moose;
 with 'Moose::Autobox::Array';
 
+*does = \&Moose::Object::does;
+
 package HASH;
+use base 'Moose::Autobox';
 use Moose;
 with 'Moose::Autobox::Hash';
 
+*does = \&Moose::Object::does;
+
 package CODE;
+use base 'Moose::Autobox';
 use Moose;
-with 'Moose::Autobox::Code';    
-    |;
-}               
+with 'Moose::Autobox::Code';  
+
+*does = \&Moose::Object::does;
+  
+#    |;
+#    confess 'Could not create autobox packages because - ' . $@ if $@;
+#}               
 
 1;
 
@@ -41,27 +61,40 @@ Moose::Autobox - autoboxed for her pleasure
 
 =head1 SYNOPOSIS
 
+  use Moose::Autobox;
+  use autobox;
+  
+  'Print squares from 1 to 10'->print;  
+  [ 1 .. 10 ]->map(sub { $_ * $_ })->join(', ')->print;
+
 =head1 DESCRIPTION
 
-  Any
-  Item 
-      Bool
-      Undef
-      Defined
-          Value
-              Num
-                Int
-              Str
-          Ref
-              ScalarRef
-              ArrayRef
-              HashRef
-              CodeRef
-              RegexpRef
-              Object   
-                  Role
+=head1 ROLES
+                                                          
+  +------------------------+-------------------------------+
+  |  Identity              |  Behavioral                   |
+  +------------------------+-------------------------------+
+  |  Item                  |                               |
+  |      Undef             |                               |
+  |      Defined           |                               |
+  |          Scalar*     <-|- String, Number <--+          |
+  |          Ref           |                    |-- Value  |
+  |              Array*  <-|- List <------------+          |
+  |              Hash*     |                               |
+  |              Code*     |                               |
+  |                        |                               |
+  +------------------------+-------------------------------+
+                                                          
+  * indicates actual autoboxed types
+  
+=head1 NOTES  
+  
+  - String, Number & List are currently the only Values.
+  
+  - Indexed is pretty much an interface, we probably will 
+    need more of these (see Smalltalk Collection Trait 
+    Refactoring)
   
-
 =head1 BUGS
 
 All complex software has bugs lurking in it, and this module is no 
@@ -81,7 +114,4 @@ L<http://www.iinteractive.com>
 This library is free software; you can redistribute it and/or modify
 it under the same terms as Perl itself.
 
-
 =cut
-
-