Mojo::Autobox - Some extra Mojo for Perl native datatypes
use Mojo::Base -strict; use Mojo::Autobox; # "site.com\n" '{"html": "<a href=\"http://site.com\"></a>"}' ->json('/html') ->dom->at('a')->{href} ->url->host ->byte_stream->say;
Using autobox, methods are provided to Perl native datatypes. This ability is then used to provide methods useful with classes from the Mojolicious toolkit. These are especially useful to contruct objects to continue a "chain" of method invocations.
The effect is lexical, and therefore is contained within the scope that the module is imported into.
When the pragma is in effect, the types are effectively blessed into the following classes:
Additionally, for one-liner fun, the class ojoBox may be used to load Mojo::Autobox and ojo.
perl -MojoBox -E 'g("http://mojolicio.us")->dom->find("a")->each(sub{$_->{href}->url->host->b->say})'
http://github.com/jberger/Mojo-Autobox
Joel Berger, <joel.a.berger@gmail.com>
Copyright (C) 2014 by Joel Berger
This library is free software; you can redistribute it and/or modify it under the same terms as Perl itself.
To install Mojo::Autobox, copy and paste the appropriate command in to your terminal.
cpanm
cpanm Mojo::Autobox
CPAN shell
perl -MCPAN -e shell install Mojo::Autobox
For more information on module installation, please visit the detailed CPAN module installation guide.