| 1 | package Elive::Entity::Role; | ||||||||||||||||||||||||||||
| 2 | 33 | ▶ | use warnings; use strict; | ||||||||||||||||||||||||||
|
Subroutine
BEGIN: called CC=1 SCAR=0.0
Subroutine
BEGIN: called CC=1 SCAR=0.0
| |||||||||||||||||||||||||||||
| 3 | |||||||||||||||||||||||||||||
| 4 | 33 | ▶ | use Mouse; | ||||||||||||||||||||||||||
|
Subroutine
BEGIN: called CC=1 SCAR=0.0
| |||||||||||||||||||||||||||||
| 5 | 33 | ▶ | use Mouse::Util::TypeConstraints; | ||||||||||||||||||||||||||
|
Subroutine
BEGIN: called CC=1 SCAR=0.0
| |||||||||||||||||||||||||||||
| 6 | |||||||||||||||||||||||||||||
| 7 | 33 | extends 'Elive::Entity'; | |||||||||||||||||||||||||||
| 8 | |||||||||||||||||||||||||||||
| 9 | =head1 NAME | ||||||||||||||||||||||||||||
| 10 | |||||||||||||||||||||||||||||
| 11 | Elive::Entity::Role - Elluminate Role entity class | ||||||||||||||||||||||||||||
| 12 | |||||||||||||||||||||||||||||
| 13 | =head1 DESCRIPTION | ||||||||||||||||||||||||||||
| 14 | |||||||||||||||||||||||||||||
| 15 | This is a structural class for Elive roles. It is a component of the | ||||||||||||||||||||||||||||
| 16 | L<Elive::Entity::User> and L<Elive::Entity::Participants::Participant> | ||||||||||||||||||||||||||||
| 17 | entities. | ||||||||||||||||||||||||||||
| 18 | |||||||||||||||||||||||||||||
| 19 | =cut | ||||||||||||||||||||||||||||
| 20 | |||||||||||||||||||||||||||||
| 21 | 33 | __PACKAGE__->entity_name('Role'); | |||||||||||||||||||||||||||
| 22 | |||||||||||||||||||||||||||||
| 23 | 33 | has 'roleId' => (is => 'rw', isa => 'Int', required => 1); | |||||||||||||||||||||||||||
| 24 | 33 | __PACKAGE__->primary_key('roleId'); | |||||||||||||||||||||||||||
| 25 | |||||||||||||||||||||||||||||
| 26 | 33 | our ( $SYSTEM_ADMIN, $APPLICATION_ADMIN, $MODERATOR, $PARTICIPANT ); | |||||||||||||||||||||||||||
| 27 | BEGIN { | ||||||||||||||||||||||||||||
| 28 | 33 | ▶ | $SYSTEM_ADMIN = 0; | ||||||||||||||||||||||||||
|
Subroutine
BEGIN: called CC=1 SCAR=0.0
| |||||||||||||||||||||||||||||
| 29 | 33 | $APPLICATION_ADMIN = 1; | |||||||||||||||||||||||||||
| 30 | 33 | $MODERATOR = 2; | |||||||||||||||||||||||||||
| 31 | 33 | $PARTICIPANT = 3; | |||||||||||||||||||||||||||
| 32 | } | ||||||||||||||||||||||||||||
| 33 | |||||||||||||||||||||||||||||
| 34 | sub BUILDARGS { | ||||||||||||||||||||||||||||
| 35 | 272 | ▶ | my $class = shift; | ||||||||||||||||||||||||||
|
Subroutine
BUILDARGS: called CC=3 SCAR=11.0
Pod
documented
| |||||||||||||||||||||||||||||
| 36 | 272 | my $spec = shift; | |||||||||||||||||||||||||||
| 37 | |||||||||||||||||||||||||||||
| 38 | 272 | my $args; | |||||||||||||||||||||||||||
| 39 | 272 | ▶ | if (defined $spec && ! ref $spec) { | ||||||||||||||||||||||||||
|
Branch: 1 branch
Condition66%2/3
defined $spec and not ref $spec
MC/DC50%1/2
defined $spec and not ref $spec
defined $spec
not ref $spec
Truth table66%2/3
A and not(B)
A= defined $specB= not ref $spec
| |||||||||||||||||||||||||||||
| 40 | 51 | $args = {roleId => $spec}; | |||||||||||||||||||||||||||
| 41 | } | ||||||||||||||||||||||||||||
| 42 | else { | ||||||||||||||||||||||||||||
| 43 | 221 | $args = $spec; | |||||||||||||||||||||||||||
| 44 | } | ||||||||||||||||||||||||||||
| 45 | |||||||||||||||||||||||||||||
| 46 | 272 | return $args; | |||||||||||||||||||||||||||
| 47 | } | ||||||||||||||||||||||||||||
| 48 | |||||||||||||||||||||||||||||
| 49 | coerce 'Elive::Entity::Role' => from 'HashRef|Int' | ||||||||||||||||||||||||||||
| 50 | 270 | ▶ | => via {Elive::Entity::Role->new($_) }; | ||||||||||||||||||||||||||
|
Subroutine
__ANON__: called CC=1 SCAR=0.0
| |||||||||||||||||||||||||||||
| 51 | |||||||||||||||||||||||||||||
| 52 | 33 | 1; | |||||||||||||||||||||||||||