NAME
Moose::Autobox - Ruby ain't got nothin on us
SYNOPOSIS
use Moose::Autobox;
print 'Print squares from 1 to 10 : ';
print [ 1 .. 10 ]->map(sub { $_ * $_ })->join(', ');
CAVEAT
First, a warning.
This module is very very very very very very very experimental. It makes use of a very experimental module (autobox) and uses some shiney new technology (Moose::Role) to accomplish it's goals.
Use this at your own risk. If it breaks the lamp in the living room and your mother yells at you, don't come complaining to me.
Also, as this is so experimental, it's API should not be considered to be stable. It could very well change in radical ways.
DESCRIPTION
Moose::Autobox provides an implementation of SCALAR, ARRAY, HASH & CODE for use with autobox. It does this using a hierarchy of roles in a manner similar to what Perl 6 might do. This module, like Class::MOP and Moose, was inspired by my work on the Perl 6 Object Space, and the 'core types' implemented there.
A quick word about autobox
The autobox module provides the ability for calling 'methods' on normal Perl values like Scalars, Arrays, Hashes and Code references. This gives the illusion that Perl's types are first-class objects. However, this is only an illusion, albeit a very nice one. I created this module because autobox itself does not actually provide an implementation for the Perl types but instead only provides the 'hooks' for others to add implementation too.
Is this for real? or just play?
My intent is to try and make this module as production worthy as possible. This may or may not be possible, depending on how well autobox works out. At this point, I have high hopes for things but only time (and more tests and code) will tell.
METHODS
- mixin_additional_role ($type, $role)
-
This will mixin an additonal
$role
into a certain$type
. The types can be SCALAR, ARRAY, HASH or CODE.This can be used to add additional methods to the types, see the examples/units/ directory for some examples.
TODO
BUGS
All complex software has bugs lurking in it, and this module is no exception. If you find a bug please either email me, or add the bug to cpan-RT.
AUTHOR
Stevan Little <stevan@iinteractive.com>
with contributions from:
Anders (Debolaz) Nor Berle
Matt (mst) Trout
renormalist
COPYRIGHT AND LICENSE
Copyright 2006-2007 by Infinity Interactive, Inc.
This library is free software; you can redistribute it and/or modify it under the same terms as Perl itself.