| 1 | package Acme::CPANModules::Roles; | ||
| 2 | |||
| 3 | 1 | our $AUTHORITY = 'cpan:PERLANCAR'; # AUTHORITY | |
| 4 | 1 | our $DATE = '2020-05-04'; # DATE | |
| 5 | 1 | our $DIST = 'Acme-CPANModules-Roles'; # DIST | |
| 6 | 1 | our $VERSION = '0.001'; # VERSION | |
| 7 | |||
| 8 | 1 | ▶ | use strict; |
|
Subroutine
BEGIN: called CC=1 SCAR=0.0
| |||
| 9 | 1 | ▶ | use Acme::CPANModulesUtil::Misc; |
|
Subroutine
BEGIN: called CC=1 SCAR=0.0
| |||
| 10 | |||
| 11 | 1 | our $LIST = { | |
| 12 | summary => "Doing roles with Perl", | ||
| 13 | description => <<'_', | ||
| 14 | |||
| 15 | Roles are a way to write classes by composing them from simpler components, | ||
| 16 | instead of using inheritance from parent classes. | ||
| 17 | |||
| 18 | The Perl core does not provide a role mechanism for you, but there are several | ||
| 19 | role frameworks you can choose in Perl. This list orders them from the most | ||
| 20 | lightweight. | ||
| 21 | |||
| 22 | <pm:Role::Tiny>. Basic role support plus method modifiers (`before`, `after`, | ||
| 23 | `around`). | ||
| 24 | |||
| 25 | <pm:Moo::Role>. Based on Role::Tiny, it adds attribute support. Suitable if you | ||
| 26 | use <pm:Moo> as your object system. | ||
| 27 | |||
| 28 | <pm:Role::Basic>. Despite having less features than Role::Tiny (no method | ||
| 29 | modifiers), Role::Basic starts a bit slower because it loads some more modules. | ||
| 30 | |||
| 31 | <pm:Mouse::Role>. Suitable only if you are already using <pm:Mouse> as your | ||
| 32 | object system. | ||
| 33 | |||
| 34 | <pm:Moose::Role>. Offers the most features (particularly the meta protocol), but | ||
| 35 | also the heaviest. Suitable only if you are already using <pm:Moose> as your | ||
| 36 | object system. | ||
| 37 | _ | ||
| 38 | }; | ||
| 39 | |||
| 40 | 1 | Acme::CPANModulesUtil::Misc::populate_entries_from_module_links_in_description; | |
| 41 | |||
| 42 | 1 | 1; | |
| 43 | # ABSTRACT: Doing roles with Perl | ||
| 44 | |||
| 45 | __END__ | ||