Role::Commons(3pm)
π Role::Commons π
okay so bestie, welcome to Role::Commons β the Perl module (that's the 3pm bit, iykyk) that's literally just roles you can slap onto your classes for the mutual benefit of everyone. π
β¨ 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');
like... look at that. -all and suddenly your class is serving. π
π¦ DESCRIPTION π¦
Role-Commons is not yet another implementation of roles, ok?? it is not that. what it actually 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 they automatically integrate into the Moose object system if you're using it, but bestie β they do not require Moose. no cap.
the Role::Commons module itself provides shortcuts for applying roles to your package, so that instead of doing this whole entire thing:
{
package Local::Class;
use Moo; # or "use Moose"
with qw( Role::Commons::Authority Role::Commons::ObjectID );
}
you can just do this, which is so much cuter:
{
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 β rip π)
β Roles β
Role::Commons::Authorityβ sets up aAUTHORITYmethod for your class, which is conceptually a little likeVERSION. iconic behavior honestly.Role::Commons::ObjectIDβ provides anobject_idmethod for your class which returns a unique identifier for each object. every object gets its own little name tag πRole::Commons::Tapβ provides atapmethod for your class, inspired by Ruby's method of the same name. super 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. rest in peace to the OGs π―οΈ
Role-Commons bundles Object::AUTHORITY for the sake of backwards compatibility. this is being phased out. β οΈ like, don't build your whole personality around it, it's on the way out.
π BUGS π
please report any bugs to <http://rt.cpan.org/Dist/Display.html?Queue=Role-Commons>. bestie if something's broken, tell me, don't just suffer in silence π«Ά
π 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. slay. π
π₯ 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.
(there's no warranty bestie, we've been over this π)
and that's the whole page!! this one came from perl v5.32.0, dated 2021-01-05, and it's the manual for Role::Commons(3pm) β mwah, go forth and apply some roles πβ¨π¦
π¦ where this page comes from
- debian bookworm: librole-commons-perl 0.104-1.1 Β· Artistic-1.0-Perl OR GPL-1.0-or-later
- ubuntu jammy: librole-commons-perl 0.104-1.1 Β· Artistic-1.0-Perl OR GPL-1.0-or-later
- ubuntu noble: librole-commons-perl 0.104-1.1 Β· Artistic-1.0-Perl OR GPL-1.0-or-later
- π girlified by deepseek-ai/DeepSeek-V4.1-Flash on : a language model's rewrite of the original, under its terms