2 package Moose::Autobox;
10 our $VERSION = '0.03';
15 (shift)->SUPER::import(
16 DEFAULT => 'Moose::Autobox::',
17 UNDEF => 'Moose::Autobox::Undef',
21 package Moose::Autobox::SCALAR;
23 # this doesnt make sense, but
24 # I need to prevent Moose from
28 with 'Moose::Autobox::Scalar';
30 *does = \&Moose::Object::does;
32 package Moose::Autobox::ARRAY;
35 with 'Moose::Autobox::Array';
37 *does = \&Moose::Object::does;
39 package Moose::Autobox::HASH;
42 with 'Moose::Autobox::Hash';
44 *does = \&Moose::Object::does;
46 package Moose::Autobox::CODE;
49 with 'Moose::Autobox::Code';
51 *does = \&Moose::Object::does;
61 Moose::Autobox - Autoboxed for her pleasure
68 print 'Print squares from 1 to 10 : ';
69 print [ 1 .. 10 ]->map(sub { $_ * $_ })->join(', ');
75 This module is very very very very very very very experimental. It
76 makes use of a very experimental module (L<autobox>) and uses some
77 shiney new technology (L<Moose::Role>) to accomplish it's goals.
79 Use this at your own risk. If it breaks the lamp in the living room
80 and your mother yells at you, don't come complaining to me.
82 Also, as this is so experimental, it's API should not be considered
83 to be stable. It could very well change in radical ways.
87 Moose::Autobox provides an implementation of SCALAR, ARRAY, HASH
88 & CODE for use with L<autobox>. It does this using a hierarchy of
89 roles in a manner similar to what Perl 6 I<might> do. This module,
90 like L<Class::MOP> and L<Moose>, was inspired by my work on the
91 Perl 6 Object Space, and the 'core types' implemented there.
93 =head2 A quick word about autobox
95 The L<autobox> module provides the ability for calling 'methods'
96 on normal Perl values like Scalars, Arrays, Hashes and Code
97 references. This gives the illusion that Perl's types are first-class
98 objects. However, this is only an illusion, albeit a very nice one.
99 I created this module because L<autobox> itself does not actually
100 provide an implementation for the Perl types but instead only provides
101 the 'hooks' for others to add implementation too.
103 =head2 Is this for real? or just play?
105 My intent is to try and make this module as production worthy as
106 possible. This may or may not be possible, depending on how well
107 L<autobox> works out. At this point, I have high hopes for things
108 but only time (and more tests and code) will tell.
112 This is a rough diagram of the roles involved to get our 4
113 autoboxed types (SCALAR, ARRAY, HASH & CODE).
115 +------------------------+-------------------------------+
116 | Identity | Behavioral |
117 +------------------------+-------------------------------+
121 | Scalar* <-|- String, Number <--+ |
123 | Array* <-|- List <------------+ |
127 +------------------------+-------------------------------+
129 * indicates actual autoboxed types
143 - String, Number & List are currently the only 'Value's.
145 - Indexed is pretty much an interface, we probably will
146 need more of these (see Smalltalk Collection Trait
151 All complex software has bugs lurking in it, and this module is no
152 exception. If you find a bug please either email me, or add the bug
157 Stevan Little E<lt>stevan@iinteractive.comE<gt>
159 =head1 COPYRIGHT AND LICENSE
161 Copyright 2006 by Infinity Interactive, Inc.
163 L<http://www.iinteractive.com>
165 This library is free software; you can redistribute it and/or modify
166 it under the same terms as Perl itself.
170 package Moose::Autobox;
175 use Carp qw(confess);
178 our $VERSION = '0.02';
180 package Moose::Autobox::SCALAR;
182 # this doesnt make sense, but
183 # I need to prevent Moose from
185 use base 'UNIVERSAL';
187 with 'Moose::Autobox::Scalar';
189 *does = \&Moose::Object::does;
191 package Moose::Autobox::ARRAY;
192 use base 'UNIVERSAL';
194 with 'Moose::Autobox::Array';
196 *does = \&Moose::Object::does;
198 package Moose::Autobox::HASH;
199 use base 'UNIVERSAL';
201 with 'Moose::Autobox::Hash';
203 *does = \&Moose::Object::does;
205 package Moose::Autobox::CODE;
206 use base 'UNIVERSAL';
208 with 'Moose::Autobox::Code';
210 *does = \&Moose::Object::does;
220 Moose::Autobox - Autoboxed for her pleasure
227 print 'Print squares from 1 to 10 : ';
228 print [ 1 .. 10 ]->map(sub { $_ * $_ })->join(', ');
234 This module is very very very very very very very experimental. It
235 makes use of a very experimental module (L<autobox>) and uses some
236 shiney new technology (L<Moose::Role>) to accomplish it's goals.
238 Use this at your own risk. If it breaks the lamp in the living room
239 and your mother yells at you, don't come complaining to me.
241 Also, as this is so experimental, it's API should not be considered
242 to be stable. It could very well change in radical ways.
246 Moose::Autobox provides an implementation of SCALAR, ARRAY, HASH
247 & CODE for use with L<autobox>. It does this using a hierarchy of
248 roles in a manner similar to what Perl 6 I<might> do. This module,
249 like L<Class::MOP> and L<Moose>, was inspired by my work on the
250 Perl 6 Object Space, and the 'core types' implemented there.
252 =head2 A quick word about autobox
254 The L<autobox> module provides the ability for calling 'methods'
255 on normal Perl values like Scalars, Arrays, Hashes and Code
256 references. This gives the illusion that Perl's types are first-class
257 objects. However, this is only an illusion, albeit a very nice one.
258 I created this module because L<autobox> itself does not actually
259 provide an implementation for the Perl types but instead only provides
260 the 'hooks' for others to add implementation too.
262 =head2 Is this for real? or just play?
264 My intent is to try and make this module as production worthy as
265 possible. This may or may not be possible, depending on how well
266 L<autobox> works out. At this point, I have high hopes for things
267 but only time (and more tests and code) will tell.
271 This is a rough diagram of the roles involved to get our 4
272 autoboxed types (SCALAR, ARRAY, HASH & CODE).
274 +------------------------+-------------------------------+
275 | Identity | Behavioral |
276 +------------------------+-------------------------------+
280 | Scalar* <-|- String, Number <--+ |
282 | Array* <-|- List <------------+ |
286 +------------------------+-------------------------------+
288 * indicates actual autoboxed types
302 - String, Number & List are currently the only 'Value's.
304 - Indexed is pretty much an interface, we probably will
305 need more of these (see Smalltalk Collection Trait
310 All complex software has bugs lurking in it, and this module is no
311 exception. If you find a bug please either email me, or add the bug
316 Stevan Little E<lt>stevan@iinteractive.comE<gt>
318 =head1 COPYRIGHT AND LICENSE
320 Copyright 2006 by Infinity Interactive, Inc.
322 L<http://www.iinteractive.com>
324 This library is free software; you can redistribute it and/or modify
325 it under the same terms as Perl itself.
329 package Moose::Autobox;
334 use Carp qw(confess);
337 our $VERSION = '0.02';
339 package Moose::Autobox::SCALAR;
341 # this doesnt make sense, but
342 # I need to prevent Moose from
344 use base 'UNIVERSAL';
346 with 'Moose::Autobox::Scalar';
348 *does = \&Moose::Object::does;
350 package Moose::Autobox::ARRAY;
351 use base 'UNIVERSAL';
353 with 'Moose::Autobox::Array';
355 *does = \&Moose::Object::does;
357 package Moose::Autobox::HASH;
358 use base 'UNIVERSAL';
360 with 'Moose::Autobox::Hash';
362 *does = \&Moose::Object::does;
364 package Moose::Autobox::CODE;
365 use base 'UNIVERSAL';
367 with 'Moose::Autobox::Code';
369 *does = \&Moose::Object::does;
379 Moose::Autobox - Autoboxed for her pleasure
386 print 'Print squares from 1 to 10 : ';
387 print [ 1 .. 10 ]->map(sub { $_ * $_ })->join(', ');
393 This module is very very very very very very very experimental. It
394 makes use of a very experimental module (L<autobox>) and uses some
395 shiney new technology (L<Moose::Role>) to accomplish it's goals.
397 Use this at your own risk. If it breaks the lamp in the living room
398 and your mother yells at you, don't come complaining to me.
400 Also, as this is so experimental, it's API should not be considered
401 to be stable. It could very well change in radical ways.
405 Moose::Autobox provides an implementation of SCALAR, ARRAY, HASH
406 & CODE for use with L<autobox>. It does this using a hierarchy of
407 roles in a manner similar to what Perl 6 I<might> do. This module,
408 like L<Class::MOP> and L<Moose>, was inspired by my work on the
409 Perl 6 Object Space, and the 'core types' implemented there.
411 =head2 A quick word about autobox
413 The L<autobox> module provides the ability for calling 'methods'
414 on normal Perl values like Scalars, Arrays, Hashes and Code
415 references. This gives the illusion that Perl's types are first-class
416 objects. However, this is only an illusion, albeit a very nice one.
417 I created this module because L<autobox> itself does not actually
418 provide an implementation for the Perl types but instead only provides
419 the 'hooks' for others to add implementation too.
421 =head2 Is this for real? or just play?
423 My intent is to try and make this module as production worthy as
424 possible. This may or may not be possible, depending on how well
425 L<autobox> works out. At this point, I have high hopes for things
426 but only time (and more tests and code) will tell.
430 This is a rough diagram of the roles involved to get our 4
431 autoboxed types (SCALAR, ARRAY, HASH & CODE).
433 +------------------------+-------------------------------+
434 | Identity | Behavioral |
435 +------------------------+-------------------------------+
439 | Scalar* <-|- String, Number <--+ |
441 | Array* <-|- List <------------+ |
445 +------------------------+-------------------------------+
447 * indicates actual autoboxed types
461 - String, Number & List are currently the only 'Value's.
463 - Indexed is pretty much an interface, we probably will
464 need more of these (see Smalltalk Collection Trait
469 All complex software has bugs lurking in it, and this module is no
470 exception. If you find a bug please either email me, or add the bug
475 Stevan Little E<lt>stevan@iinteractive.comE<gt>
477 =head1 COPYRIGHT AND LICENSE
479 Copyright 2006 by Infinity Interactive, Inc.
481 L<http://www.iinteractive.com>
483 This library is free software; you can redistribute it and/or modify
484 it under the same terms as Perl itself.
488 package Moose::Autobox;
493 use Carp qw(confess);
496 our $VERSION = '0.02';
498 package Moose::Autobox::SCALAR;
500 # this doesnt make sense, but
501 # I need to prevent Moose from
503 use base 'UNIVERSAL';
505 with 'Moose::Autobox::Scalar';
507 *does = \&Moose::Object::does;
509 package Moose::Autobox::ARRAY;
510 use base 'UNIVERSAL';
512 with 'Moose::Autobox::Array';
514 *does = \&Moose::Object::does;
516 package Moose::Autobox::HASH;
517 use base 'UNIVERSAL';
519 with 'Moose::Autobox::Hash';
521 *does = \&Moose::Object::does;
523 package Moose::Autobox::CODE;
524 use base 'UNIVERSAL';
526 with 'Moose::Autobox::Code';
528 *does = \&Moose::Object::does;
538 Moose::Autobox - Autoboxed for her pleasure
545 print 'Print squares from 1 to 10 : ';
546 print [ 1 .. 10 ]->map(sub { $_ * $_ })->join(', ');
552 This module is very very very very very very very experimental. It
553 makes use of a very experimental module (L<autobox>) and uses some
554 shiney new technology (L<Moose::Role>) to accomplish it's goals.
556 Use this at your own risk. If it breaks the lamp in the living room
557 and your mother yells at you, don't come complaining to me.
559 Also, as this is so experimental, it's API should not be considered
560 to be stable. It could very well change in radical ways.
564 Moose::Autobox provides an implementation of SCALAR, ARRAY, HASH
565 & CODE for use with L<autobox>. It does this using a hierarchy of
566 roles in a manner similar to what Perl 6 I<might> do. This module,
567 like L<Class::MOP> and L<Moose>, was inspired by my work on the
568 Perl 6 Object Space, and the 'core types' implemented there.
570 =head2 A quick word about autobox
572 The L<autobox> module provides the ability for calling 'methods'
573 on normal Perl values like Scalars, Arrays, Hashes and Code
574 references. This gives the illusion that Perl's types are first-class
575 objects. However, this is only an illusion, albeit a very nice one.
576 I created this module because L<autobox> itself does not actually
577 provide an implementation for the Perl types but instead only provides
578 the 'hooks' for others to add implementation too.
580 =head2 Is this for real? or just play?
582 My intent is to try and make this module as production worthy as
583 possible. This may or may not be possible, depending on how well
584 L<autobox> works out. At this point, I have high hopes for things
585 but only time (and more tests and code) will tell.
589 This is a rough diagram of the roles involved to get our 4
590 autoboxed types (SCALAR, ARRAY, HASH & CODE).
592 +------------------------+-------------------------------+
593 | Identity | Behavioral |
594 +------------------------+-------------------------------+
598 | Scalar* <-|- String, Number <--+ |
600 | Array* <-|- List <------------+ |
604 +------------------------+-------------------------------+
606 * indicates actual autoboxed types
620 - String, Number & List are currently the only 'Value's.
622 - Indexed is pretty much an interface, we probably will
623 need more of these (see Smalltalk Collection Trait
628 All complex software has bugs lurking in it, and this module is no
629 exception. If you find a bug please either email me, or add the bug
634 Stevan Little E<lt>stevan@iinteractive.comE<gt>
636 =head1 COPYRIGHT AND LICENSE
638 Copyright 2006 by Infinity Interactive, Inc.
640 L<http://www.iinteractive.com>
642 This library is free software; you can redistribute it and/or modify
643 it under the same terms as Perl itself.
647 package Moose::Autobox;
652 use Carp qw(confess);
655 our $VERSION = '0.02';
657 package Moose::Autobox::SCALAR;
659 # this doesnt make sense, but
660 # I need to prevent Moose from
662 use base 'UNIVERSAL';
664 with 'Moose::Autobox::Scalar';
666 *does = \&Moose::Object::does;
668 package Moose::Autobox::ARRAY;
669 use base 'UNIVERSAL';
671 with 'Moose::Autobox::Array';
673 *does = \&Moose::Object::does;
675 package Moose::Autobox::HASH;
676 use base 'UNIVERSAL';
678 with 'Moose::Autobox::Hash';
680 *does = \&Moose::Object::does;
682 package Moose::Autobox::CODE;
683 use base 'UNIVERSAL';
685 with 'Moose::Autobox::Code';
687 *does = \&Moose::Object::does;
697 Moose::Autobox - Autoboxed for her pleasure
704 print 'Print squares from 1 to 10 : ';
705 print [ 1 .. 10 ]->map(sub { $_ * $_ })->join(', ');
711 This module is very very very very very very very experimental. It
712 makes use of a very experimental module (L<autobox>) and uses some
713 shiney new technology (L<Moose::Role>) to accomplish it's goals.
715 Use this at your own risk. If it breaks the lamp in the living room
716 and your mother yells at you, don't come complaining to me.
718 Also, as this is so experimental, it's API should not be considered
719 to be stable. It could very well change in radical ways.
723 Moose::Autobox provides an implementation of SCALAR, ARRAY, HASH
724 & CODE for use with L<autobox>. It does this using a hierarchy of
725 roles in a manner similar to what Perl 6 I<might> do. This module,
726 like L<Class::MOP> and L<Moose>, was inspired by my work on the
727 Perl 6 Object Space, and the 'core types' implemented there.
729 =head2 A quick word about autobox
731 The L<autobox> module provides the ability for calling 'methods'
732 on normal Perl values like Scalars, Arrays, Hashes and Code
733 references. This gives the illusion that Perl's types are first-class
734 objects. However, this is only an illusion, albeit a very nice one.
735 I created this module because L<autobox> itself does not actually
736 provide an implementation for the Perl types but instead only provides
737 the 'hooks' for others to add implementation too.
739 =head2 Is this for real? or just play?
741 My intent is to try and make this module as production worthy as
742 possible. This may or may not be possible, depending on how well
743 L<autobox> works out. At this point, I have high hopes for things
744 but only time (and more tests and code) will tell.
748 This is a rough diagram of the roles involved to get our 4
749 autoboxed types (SCALAR, ARRAY, HASH & CODE).
751 +------------------------+-------------------------------+
752 | Identity | Behavioral |
753 +------------------------+-------------------------------+
757 | Scalar* <-|- String, Number <--+ |
759 | Array* <-|- List <------------+ |
763 +------------------------+-------------------------------+
765 * indicates actual autoboxed types
779 - String, Number & List are currently the only 'Value's.
781 - Indexed is pretty much an interface, we probably will
782 need more of these (see Smalltalk Collection Trait
787 All complex software has bugs lurking in it, and this module is no
788 exception. If you find a bug please either email me, or add the bug
793 Stevan Little E<lt>stevan@iinteractive.comE<gt>
795 =head1 COPYRIGHT AND LICENSE
797 Copyright 2006 by Infinity Interactive, Inc.
799 L<http://www.iinteractive.com>
801 This library is free software; you can redistribute it and/or modify
802 it under the same terms as Perl itself.