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 | |
7dad2765 |
10 | our $VERSION = '0.03'; |
11 | |
12 | use base 'autobox'; |
13 | |
8937074a |
14 | sub import { |
7dad2765 |
15 | (shift)->SUPER::import( |
16 | DEFAULT => 'Moose::Autobox::', |
17 | UNDEF => 'Moose::Autobox::Undef', |
18 | ); |
19 | } |
20 | |
21 | package Moose::Autobox::SCALAR; |
31d40d73 |
22 | # NOTE: |
23 | # this doesnt make sense, but |
24 | # I need to prevent Moose from |
25 | # assiging to @ISA |
5272f13f |
26 | use base 'UNIVERSAL'; |
5f654d8e |
27 | use Moose; |
28 | with 'Moose::Autobox::Scalar'; |
29 | |
31d40d73 |
30 | *does = \&Moose::Object::does; |
31 | |
7dad2765 |
32 | package Moose::Autobox::ARRAY; |
5272f13f |
33 | use base 'UNIVERSAL'; |
5f654d8e |
34 | use Moose; |
35 | with 'Moose::Autobox::Array'; |
36 | |
31d40d73 |
37 | *does = \&Moose::Object::does; |
38 | |
7dad2765 |
39 | package Moose::Autobox::HASH; |
5272f13f |
40 | use base 'UNIVERSAL'; |
5f654d8e |
41 | use Moose; |
42 | with 'Moose::Autobox::Hash'; |
43 | |
31d40d73 |
44 | *does = \&Moose::Object::does; |
45 | |
7dad2765 |
46 | package Moose::Autobox::CODE; |
5272f13f |
47 | use base 'UNIVERSAL'; |
5f654d8e |
48 | use Moose; |
31d40d73 |
49 | with 'Moose::Autobox::Code'; |
50 | |
7dad2765 |
51 | *does = \&Moose::Object::does; |
52 | |
53 | 1; |
54 | |
55 | __END__ |
56 | |
57 | =pod |
58 | |
59 | =head1 NAME |
60 | |
61 | Moose::Autobox - Autoboxed for her pleasure |
62 | |
63 | =head1 SYNOPOSIS |
64 | |
65 | use Moose::Autobox; |
66 | use autobox; |
67 | |
68 | print 'Print squares from 1 to 10 : '; |
69 | print [ 1 .. 10 ]->map(sub { $_ * $_ })->join(', '); |
70 | |
71 | =head1 CAVEAT |
72 | |
73 | First, a warning. |
74 | |
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. |
78 | |
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. |
81 | |
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. |
84 | |
85 | =head1 DESCRIPTION |
86 | |
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. |
92 | |
93 | =head2 A quick word about autobox |
94 | |
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. |
102 | |
103 | =head2 Is this for real? or just play? |
104 | |
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. |
109 | |
110 | =head1 ROLES |
111 | |
112 | This is a rough diagram of the roles involved to get our 4 |
113 | autoboxed types (SCALAR, ARRAY, HASH & CODE). |
114 | |
115 | +------------------------+-------------------------------+ |
116 | | Identity | Behavioral | |
117 | +------------------------+-------------------------------+ |
118 | | Item | | |
119 | | Undef | | |
120 | | Defined | | |
121 | | Scalar* <-|- String, Number <--+ | |
122 | | Ref | |-- Value | |
123 | | Array* <-|- List <------------+ | |
124 | | Hash* | | |
125 | | Code* | | |
126 | | | | |
127 | +------------------------+-------------------------------+ |
128 | |
129 | * indicates actual autoboxed types |
130 | |
131 | =head1 TODO |
132 | |
133 | =over 4 |
134 | |
135 | =item More docs |
136 | |
137 | =item More tests |
138 | |
139 | =back |
140 | |
141 | =head1 NOTES |
142 | |
143 | - String, Number & List are currently the only 'Value's. |
144 | |
145 | - Indexed is pretty much an interface, we probably will |
146 | need more of these (see Smalltalk Collection Trait |
147 | Refactoring) |
148 | |
149 | =head1 BUGS |
150 | |
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 |
153 | to cpan-RT. |
154 | |
155 | =head1 AUTHOR |
156 | |
157 | Stevan Little E<lt>stevan@iinteractive.comE<gt> |
158 | |
159 | =head1 COPYRIGHT AND LICENSE |
160 | |
161 | Copyright 2006 by Infinity Interactive, Inc. |
162 | |
163 | L<http://www.iinteractive.com> |
164 | |
165 | This library is free software; you can redistribute it and/or modify |
166 | it under the same terms as Perl itself. |
167 | |
168 | =cut |
169 | |
170 | package Moose::Autobox; |
171 | |
172 | use strict; |
173 | use warnings; |
174 | |
175 | use Carp qw(confess); |
176 | use Scalar::Util (); |
177 | |
178 | our $VERSION = '0.02'; |
179 | |
180 | package Moose::Autobox::SCALAR; |
181 | # NOTE: |
182 | # this doesnt make sense, but |
183 | # I need to prevent Moose from |
184 | # assiging to @ISA |
185 | use base 'UNIVERSAL'; |
186 | use Moose; |
187 | with 'Moose::Autobox::Scalar'; |
188 | |
189 | *does = \&Moose::Object::does; |
190 | |
191 | package Moose::Autobox::ARRAY; |
192 | use base 'UNIVERSAL'; |
193 | use Moose; |
194 | with 'Moose::Autobox::Array'; |
195 | |
31d40d73 |
196 | *does = \&Moose::Object::does; |
5f654d8e |
197 | |
7dad2765 |
198 | package Moose::Autobox::HASH; |
199 | use base 'UNIVERSAL'; |
200 | use Moose; |
201 | with 'Moose::Autobox::Hash'; |
202 | |
203 | *does = \&Moose::Object::does; |
204 | |
205 | package Moose::Autobox::CODE; |
206 | use base 'UNIVERSAL'; |
207 | use Moose; |
208 | with 'Moose::Autobox::Code'; |
209 | |
210 | *does = \&Moose::Object::does; |
211 | |
212 | 1; |
213 | |
214 | __END__ |
215 | |
216 | =pod |
217 | |
218 | =head1 NAME |
219 | |
220 | Moose::Autobox - Autoboxed for her pleasure |
221 | |
222 | =head1 SYNOPOSIS |
223 | |
224 | use Moose::Autobox; |
225 | use autobox; |
226 | |
227 | print 'Print squares from 1 to 10 : '; |
228 | print [ 1 .. 10 ]->map(sub { $_ * $_ })->join(', '); |
229 | |
230 | =head1 CAVEAT |
231 | |
232 | First, a warning. |
233 | |
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. |
237 | |
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. |
240 | |
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. |
243 | |
244 | =head1 DESCRIPTION |
245 | |
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. |
251 | |
252 | =head2 A quick word about autobox |
253 | |
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. |
261 | |
262 | =head2 Is this for real? or just play? |
263 | |
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. |
268 | |
269 | =head1 ROLES |
270 | |
271 | This is a rough diagram of the roles involved to get our 4 |
272 | autoboxed types (SCALAR, ARRAY, HASH & CODE). |
273 | |
274 | +------------------------+-------------------------------+ |
275 | | Identity | Behavioral | |
276 | +------------------------+-------------------------------+ |
277 | | Item | | |
278 | | Undef | | |
279 | | Defined | | |
280 | | Scalar* <-|- String, Number <--+ | |
281 | | Ref | |-- Value | |
282 | | Array* <-|- List <------------+ | |
283 | | Hash* | | |
284 | | Code* | | |
285 | | | | |
286 | +------------------------+-------------------------------+ |
287 | |
288 | * indicates actual autoboxed types |
289 | |
290 | =head1 TODO |
291 | |
292 | =over 4 |
293 | |
294 | =item More docs |
295 | |
296 | =item More tests |
297 | |
298 | =back |
299 | |
300 | =head1 NOTES |
301 | |
302 | - String, Number & List are currently the only 'Value's. |
303 | |
304 | - Indexed is pretty much an interface, we probably will |
305 | need more of these (see Smalltalk Collection Trait |
306 | Refactoring) |
307 | |
308 | =head1 BUGS |
309 | |
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 |
312 | to cpan-RT. |
313 | |
314 | =head1 AUTHOR |
315 | |
316 | Stevan Little E<lt>stevan@iinteractive.comE<gt> |
317 | |
318 | =head1 COPYRIGHT AND LICENSE |
319 | |
320 | Copyright 2006 by Infinity Interactive, Inc. |
321 | |
322 | L<http://www.iinteractive.com> |
323 | |
324 | This library is free software; you can redistribute it and/or modify |
325 | it under the same terms as Perl itself. |
326 | |
327 | =cut |
328 | |
329 | package Moose::Autobox; |
330 | |
331 | use strict; |
332 | use warnings; |
333 | |
334 | use Carp qw(confess); |
335 | use Scalar::Util (); |
336 | |
337 | our $VERSION = '0.02'; |
338 | |
339 | package Moose::Autobox::SCALAR; |
340 | # NOTE: |
341 | # this doesnt make sense, but |
342 | # I need to prevent Moose from |
343 | # assiging to @ISA |
344 | use base 'UNIVERSAL'; |
345 | use Moose; |
346 | with 'Moose::Autobox::Scalar'; |
347 | |
348 | *does = \&Moose::Object::does; |
349 | |
350 | package Moose::Autobox::ARRAY; |
351 | use base 'UNIVERSAL'; |
352 | use Moose; |
353 | with 'Moose::Autobox::Array'; |
354 | |
355 | *does = \&Moose::Object::does; |
356 | |
357 | package Moose::Autobox::HASH; |
358 | use base 'UNIVERSAL'; |
359 | use Moose; |
360 | with 'Moose::Autobox::Hash'; |
361 | |
362 | *does = \&Moose::Object::does; |
363 | |
364 | package Moose::Autobox::CODE; |
365 | use base 'UNIVERSAL'; |
366 | use Moose; |
367 | with 'Moose::Autobox::Code'; |
368 | |
369 | *does = \&Moose::Object::does; |
370 | |
371 | 1; |
372 | |
373 | __END__ |
374 | |
375 | =pod |
376 | |
377 | =head1 NAME |
378 | |
379 | Moose::Autobox - Autoboxed for her pleasure |
380 | |
381 | =head1 SYNOPOSIS |
382 | |
383 | use Moose::Autobox; |
384 | use autobox; |
385 | |
386 | print 'Print squares from 1 to 10 : '; |
387 | print [ 1 .. 10 ]->map(sub { $_ * $_ })->join(', '); |
388 | |
389 | =head1 CAVEAT |
390 | |
391 | First, a warning. |
392 | |
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. |
396 | |
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. |
399 | |
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. |
402 | |
403 | =head1 DESCRIPTION |
404 | |
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. |
410 | |
411 | =head2 A quick word about autobox |
412 | |
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. |
420 | |
421 | =head2 Is this for real? or just play? |
422 | |
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. |
427 | |
428 | =head1 ROLES |
429 | |
430 | This is a rough diagram of the roles involved to get our 4 |
431 | autoboxed types (SCALAR, ARRAY, HASH & CODE). |
432 | |
433 | +------------------------+-------------------------------+ |
434 | | Identity | Behavioral | |
435 | +------------------------+-------------------------------+ |
436 | | Item | | |
437 | | Undef | | |
438 | | Defined | | |
439 | | Scalar* <-|- String, Number <--+ | |
440 | | Ref | |-- Value | |
441 | | Array* <-|- List <------------+ | |
442 | | Hash* | | |
443 | | Code* | | |
444 | | | | |
445 | +------------------------+-------------------------------+ |
446 | |
447 | * indicates actual autoboxed types |
448 | |
449 | =head1 TODO |
450 | |
451 | =over 4 |
452 | |
453 | =item More docs |
454 | |
455 | =item More tests |
456 | |
457 | =back |
458 | |
459 | =head1 NOTES |
460 | |
461 | - String, Number & List are currently the only 'Value's. |
462 | |
463 | - Indexed is pretty much an interface, we probably will |
464 | need more of these (see Smalltalk Collection Trait |
465 | Refactoring) |
466 | |
467 | =head1 BUGS |
468 | |
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 |
471 | to cpan-RT. |
472 | |
473 | =head1 AUTHOR |
474 | |
475 | Stevan Little E<lt>stevan@iinteractive.comE<gt> |
476 | |
477 | =head1 COPYRIGHT AND LICENSE |
478 | |
479 | Copyright 2006 by Infinity Interactive, Inc. |
480 | |
481 | L<http://www.iinteractive.com> |
482 | |
483 | This library is free software; you can redistribute it and/or modify |
484 | it under the same terms as Perl itself. |
485 | |
486 | =cut |
487 | |
488 | package Moose::Autobox; |
489 | |
490 | use strict; |
491 | use warnings; |
492 | |
493 | use Carp qw(confess); |
494 | use Scalar::Util (); |
495 | |
496 | our $VERSION = '0.02'; |
497 | |
498 | package Moose::Autobox::SCALAR; |
499 | # NOTE: |
500 | # this doesnt make sense, but |
501 | # I need to prevent Moose from |
502 | # assiging to @ISA |
503 | use base 'UNIVERSAL'; |
504 | use Moose; |
505 | with 'Moose::Autobox::Scalar'; |
506 | |
507 | *does = \&Moose::Object::does; |
508 | |
509 | package Moose::Autobox::ARRAY; |
510 | use base 'UNIVERSAL'; |
511 | use Moose; |
512 | with 'Moose::Autobox::Array'; |
513 | |
514 | *does = \&Moose::Object::does; |
515 | |
516 | package Moose::Autobox::HASH; |
517 | use base 'UNIVERSAL'; |
518 | use Moose; |
519 | with 'Moose::Autobox::Hash'; |
520 | |
521 | *does = \&Moose::Object::does; |
522 | |
523 | package Moose::Autobox::CODE; |
524 | use base 'UNIVERSAL'; |
525 | use Moose; |
526 | with 'Moose::Autobox::Code'; |
527 | |
528 | *does = \&Moose::Object::does; |
529 | |
530 | 1; |
531 | |
532 | __END__ |
533 | |
534 | =pod |
535 | |
536 | =head1 NAME |
537 | |
538 | Moose::Autobox - Autoboxed for her pleasure |
539 | |
540 | =head1 SYNOPOSIS |
541 | |
542 | use Moose::Autobox; |
543 | use autobox; |
544 | |
545 | print 'Print squares from 1 to 10 : '; |
546 | print [ 1 .. 10 ]->map(sub { $_ * $_ })->join(', '); |
547 | |
548 | =head1 CAVEAT |
549 | |
550 | First, a warning. |
551 | |
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. |
555 | |
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. |
558 | |
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. |
561 | |
562 | =head1 DESCRIPTION |
563 | |
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. |
569 | |
570 | =head2 A quick word about autobox |
571 | |
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. |
579 | |
580 | =head2 Is this for real? or just play? |
581 | |
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. |
586 | |
587 | =head1 ROLES |
588 | |
589 | This is a rough diagram of the roles involved to get our 4 |
590 | autoboxed types (SCALAR, ARRAY, HASH & CODE). |
591 | |
592 | +------------------------+-------------------------------+ |
593 | | Identity | Behavioral | |
594 | +------------------------+-------------------------------+ |
595 | | Item | | |
596 | | Undef | | |
597 | | Defined | | |
598 | | Scalar* <-|- String, Number <--+ | |
599 | | Ref | |-- Value | |
600 | | Array* <-|- List <------------+ | |
601 | | Hash* | | |
602 | | Code* | | |
603 | | | | |
604 | +------------------------+-------------------------------+ |
605 | |
606 | * indicates actual autoboxed types |
607 | |
608 | =head1 TODO |
609 | |
610 | =over 4 |
611 | |
612 | =item More docs |
613 | |
614 | =item More tests |
615 | |
616 | =back |
617 | |
618 | =head1 NOTES |
619 | |
620 | - String, Number & List are currently the only 'Value's. |
621 | |
622 | - Indexed is pretty much an interface, we probably will |
623 | need more of these (see Smalltalk Collection Trait |
624 | Refactoring) |
625 | |
626 | =head1 BUGS |
627 | |
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 |
630 | to cpan-RT. |
631 | |
632 | =head1 AUTHOR |
633 | |
634 | Stevan Little E<lt>stevan@iinteractive.comE<gt> |
635 | |
636 | =head1 COPYRIGHT AND LICENSE |
637 | |
638 | Copyright 2006 by Infinity Interactive, Inc. |
639 | |
640 | L<http://www.iinteractive.com> |
641 | |
642 | This library is free software; you can redistribute it and/or modify |
643 | it under the same terms as Perl itself. |
644 | |
645 | =cut |
646 | |
647 | package Moose::Autobox; |
648 | |
649 | use strict; |
650 | use warnings; |
651 | |
652 | use Carp qw(confess); |
653 | use Scalar::Util (); |
654 | |
655 | our $VERSION = '0.02'; |
656 | |
657 | package Moose::Autobox::SCALAR; |
658 | # NOTE: |
659 | # this doesnt make sense, but |
660 | # I need to prevent Moose from |
661 | # assiging to @ISA |
662 | use base 'UNIVERSAL'; |
663 | use Moose; |
664 | with 'Moose::Autobox::Scalar'; |
665 | |
666 | *does = \&Moose::Object::does; |
667 | |
668 | package Moose::Autobox::ARRAY; |
669 | use base 'UNIVERSAL'; |
670 | use Moose; |
671 | with 'Moose::Autobox::Array'; |
672 | |
673 | *does = \&Moose::Object::does; |
674 | |
675 | package Moose::Autobox::HASH; |
676 | use base 'UNIVERSAL'; |
677 | use Moose; |
678 | with 'Moose::Autobox::Hash'; |
679 | |
680 | *does = \&Moose::Object::does; |
681 | |
682 | package Moose::Autobox::CODE; |
683 | use base 'UNIVERSAL'; |
684 | use Moose; |
685 | with 'Moose::Autobox::Code'; |
686 | |
687 | *does = \&Moose::Object::does; |
688 | |
5f654d8e |
689 | 1; |
690 | |
691 | __END__ |
692 | |
693 | =pod |
694 | |
695 | =head1 NAME |
696 | |
8937074a |
697 | Moose::Autobox - Autoboxed for her pleasure |
5f654d8e |
698 | |
699 | =head1 SYNOPOSIS |
700 | |
39894c95 |
701 | use Moose::Autobox; |
702 | use autobox; |
31d40d73 |
703 | |
8937074a |
704 | print 'Print squares from 1 to 10 : '; |
705 | print [ 1 .. 10 ]->map(sub { $_ * $_ })->join(', '); |
706 | |
707 | =head1 CAVEAT |
708 | |
709 | First, a warning. |
710 | |
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. |
714 | |
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. |
39894c95 |
717 | |
1972aa1b |
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. |
720 | |
5f654d8e |
721 | =head1 DESCRIPTION |
722 | |
8937074a |
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. |
728 | |
729 | =head2 A quick word about autobox |
730 | |
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. |
738 | |
739 | =head2 Is this for real? or just play? |
740 | |
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. |
745 | |
39894c95 |
746 | =head1 ROLES |
8937074a |
747 | |
748 | This is a rough diagram of the roles involved to get our 4 |
749 | autoboxed types (SCALAR, ARRAY, HASH & CODE). |
260cc81f |
750 | |
751 | +------------------------+-------------------------------+ |
752 | | Identity | Behavioral | |
753 | +------------------------+-------------------------------+ |
754 | | Item | | |
755 | | Undef | | |
756 | | Defined | | |
757 | | Scalar* <-|- String, Number <--+ | |
758 | | Ref | |-- Value | |
759 | | Array* <-|- List <------------+ | |
760 | | Hash* | | |
761 | | Code* | | |
762 | | | | |
763 | +------------------------+-------------------------------+ |
764 | |
39894c95 |
765 | * indicates actual autoboxed types |
1972aa1b |
766 | |
767 | =head1 TODO |
768 | |
769 | =over 4 |
770 | |
771 | =item More docs |
772 | |
773 | =item More tests |
774 | |
775 | =back |
31d40d73 |
776 | |
777 | =head1 NOTES |
778 | |
8937074a |
779 | - String, Number & List are currently the only 'Value's. |
31d40d73 |
780 | |
781 | - Indexed is pretty much an interface, we probably will |
782 | need more of these (see Smalltalk Collection Trait |
783 | Refactoring) |
784 | |
5f654d8e |
785 | =head1 BUGS |
786 | |
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 |
789 | to cpan-RT. |
790 | |
791 | =head1 AUTHOR |
792 | |
793 | Stevan Little E<lt>stevan@iinteractive.comE<gt> |
794 | |
795 | =head1 COPYRIGHT AND LICENSE |
796 | |
797 | Copyright 2006 by Infinity Interactive, Inc. |
798 | |
799 | L<http://www.iinteractive.com> |
800 | |
801 | This library is free software; you can redistribute it and/or modify |
802 | it under the same terms as Perl itself. |
803 | |
5f654d8e |
804 | =cut |