| 1 | package Text::Tradition::Ownership; | ||
| 2 | |||
| 3 | 4 | ▶ | use strict; |
|
Subroutine
BEGIN: called CC=1 SCAR=0.0
| |||
| 4 | 4 | ▶ | use warnings; |
|
Subroutine
BEGIN: called CC=1 SCAR=0.0
| |||
| 5 | 4 | ▶ | use Moose::Role; |
|
Subroutine
BEGIN: called CC=1 SCAR=0.0
| |||
| 6 | 4 | ▶ | use Text::Tradition::User; |
|
Subroutine
BEGIN: called CC=1 SCAR=0.0
| |||
| 7 | |||
| 8 | 4 | requires 'throw'; | |
| 9 | |||
| 10 | =head1 NAME | ||
| 11 | |||
| 12 | Text::Tradition::Ownership - add-on role to enable Text::Tradition objects | ||
| 13 | to have users who own them. | ||
| 14 | |||
| 15 | =head1 METHODS | ||
| 16 | |||
| 17 | =head2 user | ||
| 18 | |||
| 19 | Accessor for the owner of the tradition. | ||
| 20 | |||
| 21 | =head2 public | ||
| 22 | |||
| 23 | Whether this tradition should be accessible (readonly) to anyone who is not | ||
| 24 | the owner. | ||
| 25 | |||
| 26 | =cut | ||
| 27 | |||
| 28 | 4 | has 'user' => ( | |
| 29 | is => 'rw', | ||
| 30 | isa => 'Text::Tradition::User', | ||
| 31 | required => 0, | ||
| 32 | predicate => 'has_user', | ||
| 33 | clearer => 'clear_user', | ||
| 34 | weak_ref => 1 | ||
| 35 | ); | ||
| 36 | |||
| 37 | has 'public' => ( | ||
| 38 | is => 'rw', | ||
| 39 | isa => 'Bool', | ||
| 40 | required => 0, | ||
| 41 | 9 | ▶ | default => sub { 0; }, |
|
Subroutine
__ANON__: called CC=1 SCAR=0.0
| |||
| 42 | 4 | ); | |
| 43 | |||
| 44 | |||
| 45 | 4 | 1; | |
| 46 | |||