---
name: "Role::Commons"
section: "3pm"
platform: "linux"
package: "librole-commons-perl"
version: "0.104-2"
release: "Debian 13 (Trixie)"
platforms: ["linux"]
url: "https://new.carta.tech/Role::Commons"
---

# Role::Commons(3pm)

roles that can be commonly used, for the mutual benefit of all

## NAME

Role::Commons - roles that can be commonly used, for the mutual benefit of all

## 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 `"AUTHORITY"` method for your class which is conceptually a little like `"VERSION"`.

- Role::Commons::ObjectID

  Provides an `"object_id"` method for your class which returns a unique identifier for each object.

- Role::Commons::Tap

  Provides a `"tap"` 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 bundles Object::AUTHORITY for the sake of backwards compatibility. This is being phased out.

## BUGS

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

## SEE ALSO

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

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

## AUTHOR

Toby Inkster \<tobyink@cpan.org\>.

## COPYRIGHT AND LICENCE

This software is copyright (c) 2012, 2014 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

THIS PACKAGE IS PROVIDED "AS IS" AND WITHOUT ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, WITHOUT LIMITATION, THE IMPLIED WARRANTIES OF MERCHANTIBILITY AND FITNESS FOR A PARTICULAR PURPOSE.
