line |
stmt |
bran |
cond |
sub |
pod |
time |
code |
1
|
|
|
|
|
|
|
package PAUSE::Permissions::Module; |
2
|
|
|
|
|
|
|
$PAUSE::Permissions::Module::VERSION = '0.17'; |
3
|
6
|
|
|
6
|
|
42
|
use Moo; |
|
6
|
|
|
|
|
16
|
|
|
6
|
|
|
|
|
32
|
|
4
|
|
|
|
|
|
|
|
5
|
|
|
|
|
|
|
# TODO: I had isa when I was using Moose, need to put those back |
6
|
|
|
|
|
|
|
|
7
|
|
|
|
|
|
|
has 'name' => (is => 'ro'); |
8
|
|
|
|
|
|
|
|
9
|
|
|
|
|
|
|
# has 'm' => (is => 'ro', isa => 'Str'); |
10
|
|
|
|
|
|
|
has 'm' => (is => 'ro'); |
11
|
|
|
|
|
|
|
|
12
|
|
|
|
|
|
|
# has 'f' => (is => 'ro', isa => 'Str'); |
13
|
|
|
|
|
|
|
has 'f' => (is => 'ro'); |
14
|
|
|
|
|
|
|
|
15
|
|
|
|
|
|
|
# has 'c' => (is => 'ro', isa => 'ArrayRef[Str]'); |
16
|
|
|
|
|
|
|
has 'c' => (is => 'ro'); |
17
|
|
|
|
|
|
|
|
18
|
|
|
|
|
|
|
sub owner |
19
|
|
|
|
|
|
|
{ |
20
|
52
|
|
|
52
|
1
|
4875
|
my $self = shift; |
21
|
|
|
|
|
|
|
|
22
|
52
|
|
100
|
|
|
362
|
return $self->m || $self->f || undef; |
23
|
|
|
|
|
|
|
} |
24
|
|
|
|
|
|
|
|
25
|
|
|
|
|
|
|
sub registered_maintainer |
26
|
|
|
|
|
|
|
{ |
27
|
6
|
|
|
6
|
1
|
2623
|
my $self = shift; |
28
|
6
|
|
100
|
|
|
41
|
return $self->m || undef; |
29
|
|
|
|
|
|
|
} |
30
|
|
|
|
|
|
|
|
31
|
|
|
|
|
|
|
sub first_come |
32
|
|
|
|
|
|
|
{ |
33
|
6
|
|
|
6
|
1
|
3109
|
my $self = shift; |
34
|
6
|
|
100
|
|
|
41
|
return $self->f || undef; |
35
|
|
|
|
|
|
|
} |
36
|
|
|
|
|
|
|
|
37
|
|
|
|
|
|
|
sub co_maintainers |
38
|
|
|
|
|
|
|
{ |
39
|
16
|
|
|
16
|
1
|
2697
|
my $self = shift; |
40
|
16
|
|
|
|
|
28
|
my @comaints; |
41
|
|
|
|
|
|
|
|
42
|
16
|
100
|
100
|
|
|
104
|
push(@comaints, $self->f) if defined($self->m) && defined($self->f); |
43
|
16
|
100
|
|
|
|
56
|
push(@comaints, @{ $self->c }) if defined($self->c); |
|
13
|
|
|
|
|
39
|
|
44
|
|
|
|
|
|
|
|
45
|
16
|
|
|
|
|
43
|
@comaints = sort @comaints; |
46
|
16
|
|
|
|
|
112
|
return @comaints; |
47
|
|
|
|
|
|
|
} |
48
|
|
|
|
|
|
|
|
49
|
|
|
|
|
|
|
sub all_maintainers |
50
|
|
|
|
|
|
|
{ |
51
|
31
|
|
|
31
|
1
|
2591
|
my $self = shift; |
52
|
31
|
|
|
|
|
55
|
my @all; |
53
|
|
|
|
|
|
|
|
54
|
31
|
100
|
|
|
|
111
|
push(@all, $self->m) if defined($self->m); |
55
|
31
|
100
|
|
|
|
98
|
push(@all, $self->f) if defined($self->f); |
56
|
31
|
100
|
|
|
|
106
|
push(@all, @{ $self->c }) if defined($self->c); |
|
25
|
|
|
|
|
63
|
|
57
|
|
|
|
|
|
|
|
58
|
31
|
|
|
|
|
95
|
@all = sort @all; |
59
|
31
|
|
|
|
|
138
|
return @all; |
60
|
|
|
|
|
|
|
} |
61
|
|
|
|
|
|
|
|
62
|
|
|
|
|
|
|
1; |
63
|
|
|
|
|
|
|
|
64
|
|
|
|
|
|
|
=head1 NAME |
65
|
|
|
|
|
|
|
|
66
|
|
|
|
|
|
|
PAUSE::Permissions::Module - PAUSE permissions for one module (from 06perms.txt) |
67
|
|
|
|
|
|
|
|
68
|
|
|
|
|
|
|
=head1 SYNOPSIS |
69
|
|
|
|
|
|
|
|
70
|
|
|
|
|
|
|
use PAUSE::Permissions::Module; |
71
|
|
|
|
|
|
|
|
72
|
|
|
|
|
|
|
my %options = |
73
|
|
|
|
|
|
|
( |
74
|
|
|
|
|
|
|
name => 'HTTP::Client', |
75
|
|
|
|
|
|
|
m => 'LINC', |
76
|
|
|
|
|
|
|
f => 'P5P, |
77
|
|
|
|
|
|
|
c => ['NEILB'], |
78
|
|
|
|
|
|
|
); |
79
|
|
|
|
|
|
|
|
80
|
|
|
|
|
|
|
my $mp = PAUSE::Permissions::Module->new( %options ); |
81
|
|
|
|
|
|
|
|
82
|
|
|
|
|
|
|
print "owner = ", $mp->owner, "\n"; |
83
|
|
|
|
|
|
|
|
84
|
|
|
|
|
|
|
=head1 DESCRIPTION |
85
|
|
|
|
|
|
|
|
86
|
|
|
|
|
|
|
PAUSE::Permissions::Module is a data class, an instance of which is returned |
87
|
|
|
|
|
|
|
by the C method in L. |
88
|
|
|
|
|
|
|
It's not expected that you'll instantiate this module yourself, |
89
|
|
|
|
|
|
|
but you're probably reading this to find out what methods are supported. |
90
|
|
|
|
|
|
|
|
91
|
|
|
|
|
|
|
=head1 METHODS |
92
|
|
|
|
|
|
|
|
93
|
|
|
|
|
|
|
To understand the three levels of PAUSE permissions, see L. |
94
|
|
|
|
|
|
|
|
95
|
|
|
|
|
|
|
=head2 owner |
96
|
|
|
|
|
|
|
|
97
|
|
|
|
|
|
|
Returns a single PAUSE id, or C. |
98
|
|
|
|
|
|
|
|
99
|
|
|
|
|
|
|
=head2 co_maintainers |
100
|
|
|
|
|
|
|
|
101
|
|
|
|
|
|
|
Returns a list of PAUSE ids, |
102
|
|
|
|
|
|
|
which will be empty if the module doesn't have any co-maintainers. |
103
|
|
|
|
|
|
|
The list will be sorted alphabetically. |
104
|
|
|
|
|
|
|
|
105
|
|
|
|
|
|
|
B if a module has both an 'm' permission and an 'f' permission, |
106
|
|
|
|
|
|
|
then the user with the 'f' permission will included in the list returned by C, |
107
|
|
|
|
|
|
|
because PAUSE treats them as a co-maintainer. |
108
|
|
|
|
|
|
|
|
109
|
|
|
|
|
|
|
=head2 registered_maintainer |
110
|
|
|
|
|
|
|
|
111
|
|
|
|
|
|
|
Returns the PAUSE id of the registered maintainer of the module |
112
|
|
|
|
|
|
|
(the 'm' permission), |
113
|
|
|
|
|
|
|
or C if there isn't one defined for the module. |
114
|
|
|
|
|
|
|
|
115
|
|
|
|
|
|
|
=head2 first_come |
116
|
|
|
|
|
|
|
|
117
|
|
|
|
|
|
|
Returns the PAUSE id of the 'first uploader' for the module |
118
|
|
|
|
|
|
|
(the 'f' permission), |
119
|
|
|
|
|
|
|
or C if there isn't one defined for the module. |
120
|
|
|
|
|
|
|
|
121
|
|
|
|
|
|
|
=head2 all_maintainers |
122
|
|
|
|
|
|
|
|
123
|
|
|
|
|
|
|
Returns the PAUSE id of all users who have permissions for this module, |
124
|
|
|
|
|
|
|
in alphabetical order. |
125
|
|
|
|
|
|
|
|
126
|
|
|
|
|
|
|
=head1 SEE ALSO |
127
|
|
|
|
|
|
|
|
128
|
|
|
|
|
|
|
L |
129
|
|
|
|
|
|
|
|
130
|
|
|
|
|
|
|
=head1 AUTHOR |
131
|
|
|
|
|
|
|
|
132
|
|
|
|
|
|
|
Neil Bowers Eneilb@cpan.orgE |
133
|
|
|
|
|
|
|
|
134
|
|
|
|
|
|
|
Thanks to Andreas KEnig, for patiently answering many questions |
135
|
|
|
|
|
|
|
on how this stuff all works. |
136
|
|
|
|
|
|
|
|
137
|
|
|
|
|
|
|
=head1 COPYRIGHT AND LICENSE |
138
|
|
|
|
|
|
|
|
139
|
|
|
|
|
|
|
This software is copyright (c) 2012-2013 by Neil Bowers . |
140
|
|
|
|
|
|
|
|
141
|
|
|
|
|
|
|
This is free software; you can redistribute it and/or modify it under |
142
|
|
|
|
|
|
|
the same terms as the Perl 5 programming language system itself. |
143
|
|
|
|
|
|
|
|
144
|
|
|
|
|
|
|
=cut |
145
|
|
|
|
|
|
|
|