line |
stmt |
bran |
cond |
sub |
pod |
time |
code |
1
|
|
|
|
|
|
|
package Elive::Entity::Group::Members; |
2
|
7
|
|
|
7
|
|
31
|
use warnings; use strict; |
|
7
|
|
|
7
|
|
9
|
|
|
7
|
|
|
|
|
210
|
|
|
7
|
|
|
|
|
31
|
|
|
7
|
|
|
|
|
8
|
|
|
7
|
|
|
|
|
242
|
|
3
|
|
|
|
|
|
|
|
4
|
|
|
|
|
|
|
=head1 NAME |
5
|
|
|
|
|
|
|
|
6
|
|
|
|
|
|
|
Elive::Entity::Group::Members - Group Members entity class |
7
|
|
|
|
|
|
|
|
8
|
|
|
|
|
|
|
=cut |
9
|
|
|
|
|
|
|
|
10
|
7
|
|
|
7
|
|
31
|
use Mouse; |
|
7
|
|
|
|
|
13
|
|
|
7
|
|
|
|
|
33
|
|
11
|
7
|
|
|
7
|
|
2104
|
use Mouse::Util::TypeConstraints; |
|
7
|
|
|
|
|
17
|
|
|
7
|
|
|
|
|
49
|
|
12
|
7
|
|
|
7
|
|
470
|
use Scalar::Util; |
|
7
|
|
|
|
|
8
|
|
|
7
|
|
|
|
|
241
|
|
13
|
7
|
|
|
7
|
|
311
|
use Elive::Util; |
|
7
|
|
|
|
|
9
|
|
|
7
|
|
|
|
|
133
|
|
14
|
|
|
|
|
|
|
|
15
|
7
|
|
|
7
|
|
32
|
use Elive::Entity::Group; |
|
7
|
|
|
|
|
10
|
|
|
7
|
|
|
|
|
230
|
|
16
|
7
|
|
|
7
|
|
366
|
use Elive::Entity::User; |
|
7
|
|
|
|
|
10
|
|
|
7
|
|
|
|
|
1986
|
|
17
|
|
|
|
|
|
|
|
18
|
|
|
|
|
|
|
extends 'Elive::DAO::Array'; |
19
|
|
|
|
|
|
|
__PACKAGE__->separator(','); |
20
|
|
|
|
|
|
|
|
21
|
|
|
|
|
|
|
# Elements are likley to be |
22
|
|
|
|
|
|
|
# - group objects |
23
|
|
|
|
|
|
|
# - user-ids as strings: 'someuser' |
24
|
|
|
|
|
|
|
# - group-ids strings: '*my_group' |
25
|
|
|
|
|
|
|
|
26
|
|
|
|
|
|
|
__PACKAGE__->element_class('Elive::Entity::Group|Str'); |
27
|
|
|
|
|
|
|
|
28
|
|
|
|
|
|
|
sub _build_array { |
29
|
0
|
|
|
0
|
|
|
my $class = shift; |
30
|
0
|
|
|
|
|
|
my $spec = shift; |
31
|
|
|
|
|
|
|
|
32
|
0
|
|
|
|
|
|
my $type = Elive::Util::_reftype( $spec ); |
33
|
|
|
|
|
|
|
|
34
|
0
|
|
|
|
|
|
my @members; |
35
|
|
|
|
|
|
|
|
36
|
0
|
0
|
|
|
|
|
if ($type eq 'ARRAY') { |
37
|
0
|
|
|
|
|
|
@members = map {$class->__build_elem($_)} @$spec; |
|
0
|
|
|
|
|
|
|
38
|
|
|
|
|
|
|
} |
39
|
|
|
|
|
|
|
else { |
40
|
0
|
|
|
|
|
|
@members = split($class->separator, Elive::Util::string( $spec )); |
41
|
|
|
|
|
|
|
} |
42
|
|
|
|
|
|
|
|
43
|
0
|
|
|
|
|
|
return \@members; |
44
|
|
|
|
|
|
|
} |
45
|
|
|
|
|
|
|
|
46
|
|
|
|
|
|
|
sub __build_elem { |
47
|
0
|
|
|
0
|
|
|
my $class = shift; |
48
|
0
|
|
|
|
|
|
my $elem = shift; |
49
|
|
|
|
|
|
|
|
50
|
0
|
|
|
|
|
|
my $reftype = Elive::Util::_reftype($elem); |
51
|
|
|
|
|
|
|
|
52
|
0
|
0
|
|
|
|
|
if ($reftype eq 'HASH') { |
53
|
|
|
|
|
|
|
# blessed or unblessed user struct |
54
|
0
|
0
|
|
|
|
|
if (exists $elem->{userId}) { |
|
|
0
|
|
|
|
|
|
55
|
0
|
|
|
|
|
|
return $elem->{userId}; |
56
|
|
|
|
|
|
|
} |
57
|
|
|
|
|
|
|
elsif (exists $elem->{groupId}) { |
58
|
|
|
|
|
|
|
|
59
|
0
|
0
|
|
|
|
|
$elem = Elive::Entity::Group->new($elem) |
60
|
|
|
|
|
|
|
unless Scalar::Util::blessed($elem); |
61
|
|
|
|
|
|
|
|
62
|
0
|
|
|
|
|
|
return $elem; |
63
|
|
|
|
|
|
|
} |
64
|
|
|
|
|
|
|
} |
65
|
|
|
|
|
|
|
|
66
|
0
|
|
|
|
|
|
return Elive::Util::string($elem); |
67
|
|
|
|
|
|
|
} |
68
|
|
|
|
|
|
|
|
69
|
|
|
|
|
|
|
our $class = 'Elive::Entity::Group::Members'; |
70
|
|
|
|
|
|
|
coerce $class => from 'ArrayRef|Str' |
71
|
|
|
|
|
|
|
=> via { |
72
|
|
|
|
|
|
|
$class->new( $_ ); |
73
|
|
|
|
|
|
|
}; |
74
|
|
|
|
|
|
|
|
75
|
|
|
|
|
|
|
1; |