SYNOPSIS

 use 5.010;

 {
   package Local::Class;
   use Moo;
   use Role::Commons -all;
   our $AUTHORITY = 'cpan:JOEBLOGGS';
   our $VERSION   = '1.000';
 }

 say Local::Class->AUTHORITY
   if Local::Class->DOES('Role::Commons::Authority');

 my $obj = Local::Class->new;
 say $obj->object_id
   if $obj->DOES('Role::Commons::ObjectID');

DESCRIPTION

Role-Commons is not yet another implementation of roles. It is a collection of generic, reusable roles that hopefully you will love to apply to your classes. These roles are built using Moo::Role, so automatically integrate into the Moose object system if you're using it, but they do not require Moose.

The Role::Commons module itself provides shortcuts for applying roles to your package, so that instead of doing:

{ package Local::Class;

use Moo; # or "use Moose" with qw( Role::Commons::Authority Role::Commons::ObjectID ); }

You can just do this:

{ package Local::Class;

use Moo; use Role::Commons qw( Authority ObjectID ); }

It also handles passing some simple parameters through to the role from the consuming class. (Because Moo doesn't have anything like MooseX::Role::Parameterized.)

Roles

Role::Commons::Authority

Sets up a \*(C`AUTHORITY\*(C' method for your class which is conceptually a little like \*(C`VERSION\*(C'.

Role::Commons::ObjectID

Provides an \*(C`object_id\*(C' method for your class which returns a unique identifier for each object.

Role::Commons::Tap

Provides a \*(C`tap\*(C' method for your class, inspired by Ruby's method of the same name. Helpful for writing chained method calls.

Obsolescence

Role-Commons is the successor for my older projects: authority-shared, Object-AUTHORITY, Object-DOES, Object-Role, and Object-Tap.

Role-Commons includes the following (deprecated) modules for the sake of backwards compatibility. I expect to phase them out around 2014. authority::shared, Object::AUTHORITY, Object::Tap.

BUGS

Please report any bugs to http://rt.cpan.org/Dist/Display.html?Queue=Role-Commons <http://rt.cpan.org/Dist/Display.html?Queue=Role-Commons>.

RELATED TO Role::Commons…

Role::Commons::Authority, Role::Commons::ObjectID, Role::Commons::Tap.

Role::Tiny, Moo::Role, Moose::Role.

AUTHOR

Toby Inkster <[email protected]>.

COPYRIGHT AND LICENCE

This software is copyright (c) 2012 by Toby Inkster.

This is free software; you can redistribute it and/or modify it under the same terms as the Perl 5 programming language system itself.

DISCLAIMER OF WARRANTIES

\s-1THIS\s0 \s-1PACKAGE\s0 \s-1IS\s0 \s-1PROVIDED\s0 \*(L"\s-1AS\s0 \s-1IS\s0\*(R" \s-1AND\s0 \s-1WITHOUT\s0 \s-1ANY\s0 \s-1EXPRESS\s0 \s-1OR\s0 \s-1IMPLIED\s0 \s-1WARRANTIES\s0, \s-1INCLUDING\s0, \s-1WITHOUT\s0 \s-1LIMITATION\s0, \s-1THE\s0 \s-1IMPLIED\s0 \s-1WARRANTIES\s0 \s-1OF\s0 \s-1MERCHANTIBILITY\s0 \s-1AND\s0 \s-1FITNESS\s0 \s-1FOR\s0 A \s-1PARTICULAR\s0 \s-1PURPOSE\s0.