Jojo::Role - Role::Tiny + lexical "with"
version 0.3.1
package Some::Role { use Jojo::Role; # requires perl 5.18+ sub foo {...} sub bar {...} around baz => sub {...}; } package Some::Class { use Jojo::Role -with; with 'Some::Role'; # bar gets imported, but not foo sub foo {...} # baz is wrapped in the around modifier by Class::Method::Modifiers sub baz {...} }
Jojo::Role works like Role::Tiny but with, require, before, after and around are imported as lexical subroutines.
with
require
before
after
around
This is a companion to Jojo::Base.
Jojo::Role requires perl 5.18 or newer
Because a lexical sub does not behave like a package import, some code may need to be enclosed in blocks to avoid warnings like
"state" subroutine &has masks earlier declaration in same scope at...
Role::Tiny, Mojo::Bass.
Adriano Ferreira <ferreira@cpan.org>
Adriano Ferreira <a.r.ferreira@gmail.com>
This software is copyright (c) 2017 by Adriano Ferreira.
This is free software; you can redistribute it and/or modify it under the same terms as the Perl 5 programming language system itself.
To install Jojo::Role, copy and paste the appropriate command in to your terminal.
cpanm
cpanm Jojo::Role
CPAN shell
perl -MCPAN -e shell install Jojo::Role
For more information on module installation, please visit the detailed CPAN module installation guide.