1Moose::Autobox(3)     User Contributed Perl Documentation    Moose::Autobox(3)
2
3
4

NAME

6       Moose::Autobox - Autoboxed wrappers for Native Perl datatypes
7

SYNOPOSIS

9         use Moose::Autobox;
10
11         print 'Print squares from 1 to 10 : ';
12         print [ 1 .. 10 ]->map(sub { $_ * $_ })->join(', ');
13

DESCRIPTION

15       Moose::Autobox provides an implementation of SCALAR, ARRAY, HASH & CODE
16       for use with autobox. It does this using a hierarchy of roles in a
17       manner similar to what Perl 6 might do. This module, like Class::MOP
18       and Moose, was inspired by my work on the Perl 6 Object Space, and the
19       'core types' implemented there.
20
21   A quick word about autobox
22       The autobox module provides the ability for calling 'methods' on normal
23       Perl values like Scalars, Arrays, Hashes and Code references. This
24       gives the illusion that Perl's types are first-class objects. However,
25       this is only an illusion, albeit a very nice one.  I created this
26       module because autobox itself does not actually provide an
27       implementation for the Perl types but instead only provides the 'hooks'
28       for others to add implementation too.
29
30   Is this for real? or just play?
31       Several people are using this module in serious applications and it
32       seems to be quite stable. The underlying technologies of autobox and
33       Moose::Role are also considered stable. There is some performance hit,
34       but as I am fond of saying, nothing in life is free. If you have any
35       questions regarding this module, either email me, or stop by #moose on
36       irc.perl.org and ask around.
37
38   Adding additional methods
39       Moose::Autobox asks autobox to use the Moose::Autobox::* namespace
40       prefix so as to avoid stepping on the toes of other autobox modules.
41       This means that if you want to add methods to a particular perl type
42       (i.e. - monkeypatch), then you must do this:
43
44         sub Moose::Autobox::SCALAR::bar { 42 }
45
46       instead of this:
47
48         sub SCALAR::bar { 42 }
49
50       as you would with vanilla autobox.
51

METHODS

53       mixin_additional_role ($type, $role)
54           This will mixin an additonal $role into a certain $type. The types
55           can be SCALAR, ARRAY, HASH or CODE.
56
57           This can be used to add additional methods to the types, see the
58           examples/units/ directory for some examples.
59

TODO

61       More docs
62       More tests
63

BUGS

65       All complex software has bugs lurking in it, and this module is no
66       exception. If you find a bug please either email me, or add the bug to
67       cpan-RT.
68

AUTHOR

70       Stevan Little <stevan@iinteractive.com>
71
72       with contributions from:
73
74       Anders (Debolaz) Nor Berle
75
76       Matt (mst) Trout
77
78       renormalist
79
81       Copyright 2006-2008 by Infinity Interactive, Inc.
82
83       <http://www.iinteractive.com>
84
85       This library is free software; you can redistribute it and/or modify it
86       under the same terms as Perl itself.
87
88
89
90perl v5.12.2                      2010-04-23                 Moose::Autobox(3)
Impressum