logo
Free, unlimited AI code reviews that run on commit
git-lrc git-lrc GitHub Install Now We'd appreciate a star git-lrc - Free, unlimited AI code reviews that run on commit | Product Hunt git-lrc - Free, unlimited AI code reviews that run on commit | Product Hunt

Moose::Autobox - Autoboxed wrappers for Native Perl datatypes

Author

Contributors

       •   Ricardo Signes <rjbs@cpan.org>

       •   Karen Etheridge <ether@cpan.org>

       •   Anders Nor Berle <berle@cpan.org>

       •   Matt S Trout <mst@shadowcat.co.uk>

       •   Steffen Schwigon <ss5@renormalist.net>

       •   Michael Swearingen <mswearingen@gmail.com>

       •   Florian Ragwitz <rafl@debian.org>

       •   Jonathan Rockway <jon@jrock.us>

       •   Shawn M Moore <sartak@gmail.com>

       •   Todd Hepler <thepler@employees.org>

       •   David Steinbrunner <dsteinbrunner@pobox.com>

       •   Mike Whitaker <mike@altrion.org>

       •   Nigel Gregoire <nigelgregoire@gmail.com>

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.

   Aquickwordaboutautobox
       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.

   Isthisforreal?orjustplay?
       Several people are using this module in serious applications and it seems to be quite stable. The
       underlying technologies of autobox and Moose::Role are also considered stable. There is some performance
       hit, but as I am fond of saying, nothing in life is free.  Note that this hit only applies to the use of
       methods on native Perl values, not the mere act of loading this module in your namespace.

       If you have any questions regarding this module, either email me, or stop by #moose on irc.perl.org and
       ask around.

   AddingadditionalmethodsMoose::Autobox asks autobox to use the Moose::Autobox::* namespace prefix so as to avoid stepping on the
       toes of other autobox modules. This means that if you want to add methods to a particular perl type (i.e.
       - monkeypatch), then you must do this:

         sub Moose::Autobox::SCALAR::bar { 42 }

       instead of this:

         sub SCALAR::bar { 42 }

       as you would with vanilla autobox.

Methods

       "mixin_additional_role ($type, $role)"
           This  will  mixin  an  additional $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.

Name

       Moose::Autobox - Autoboxed wrappers for Native Perl datatypes

Support

       Bugs         may        be        submitted        through        the        RT        bug        tracker
       <https://rt.cpan.org/Public/Dist/Display.html?Name=Moose-Autobox>    (or    bug-Moose-Autobox@rt.cpan.org
       <mailto:bug-Moose-Autobox@rt.cpan.org>).

       There    is    also    a    mailing    list    available    for    users   of   this   distribution,   at
       <http://lists.perl.org/list/moose.html>.

       There is also an irc channel available for users of this  distribution,  at  "#moose"  on  "irc.perl.org"
       <irc://irc.perl.org/#moose>.

Synopsis

         use Moose::Autobox;

         print 'Print squares from 1 to 10 : ';
         print [ 1 .. 10 ]->map(sub { $_ * $_ })->join(', ');

Todo

       More docs
       More tests

Version

       version 0.16

See Also