line |
stmt |
bran |
cond |
sub |
pod |
time |
code |
1
|
|
|
|
|
|
|
package RDF::DOAP::Person; |
2
|
|
|
|
|
|
|
|
3
|
|
|
|
|
|
|
our $AUTHORITY = 'cpan:TOBYINK'; |
4
|
|
|
|
|
|
|
our $VERSION = '0.104'; |
5
|
|
|
|
|
|
|
|
6
|
2
|
|
|
2
|
|
48
|
use Moose; |
|
2
|
|
|
|
|
6
|
|
|
2
|
|
|
|
|
11
|
|
7
|
|
|
|
|
|
|
extends qw(RDF::DOAP::Resource); |
8
|
|
|
|
|
|
|
|
9
|
|
|
|
|
|
|
use overload |
10
|
20
|
|
|
20
|
|
238
|
q[""] => sub { shift->to_string }, |
11
|
2
|
|
|
2
|
|
13074
|
fallback => 1; |
|
2
|
|
|
|
|
5
|
|
|
2
|
|
|
|
|
45
|
|
12
|
|
|
|
|
|
|
|
13
|
2
|
|
|
2
|
|
1063
|
use RDF::DOAP::Types -types; |
|
2
|
|
|
|
|
9
|
|
|
2
|
|
|
|
|
18
|
|
14
|
2
|
|
|
2
|
|
12978
|
use RDF::DOAP::Utils -traits; |
|
2
|
|
|
|
|
8
|
|
|
2
|
|
|
|
|
24
|
|
15
|
|
|
|
|
|
|
|
16
|
2
|
|
|
2
|
|
904
|
use RDF::Trine::Namespace qw(rdf rdfs owl xsd); |
|
2
|
|
|
|
|
4
|
|
|
2
|
|
|
|
|
26
|
|
17
|
|
|
|
|
|
|
my $foaf = 'RDF::Trine::Namespace'->new('http://xmlns.com/foaf/0.1/'); |
18
|
|
|
|
|
|
|
|
19
|
|
|
|
|
|
|
has $_ => ( |
20
|
|
|
|
|
|
|
traits => [ WithURI ], |
21
|
|
|
|
|
|
|
is => 'ro', |
22
|
|
|
|
|
|
|
isa => String, |
23
|
|
|
|
|
|
|
coerce => 1, |
24
|
|
|
|
|
|
|
uri => $foaf->$_, |
25
|
|
|
|
|
|
|
) for qw( name nick ); |
26
|
|
|
|
|
|
|
|
27
|
|
|
|
|
|
|
has mbox => ( |
28
|
|
|
|
|
|
|
traits => [ WithURI ], |
29
|
|
|
|
|
|
|
is => 'ro', |
30
|
|
|
|
|
|
|
isa => ArrayRef[Identifier], |
31
|
|
|
|
|
|
|
coerce => 1, |
32
|
|
|
|
|
|
|
uri => $foaf->mbox, |
33
|
|
|
|
|
|
|
multi => 1, |
34
|
|
|
|
|
|
|
lazy => 1, |
35
|
|
|
|
|
|
|
builder => '_build_mbox', |
36
|
|
|
|
|
|
|
); |
37
|
|
|
|
|
|
|
|
38
|
|
|
|
|
|
|
has cpanid => ( |
39
|
|
|
|
|
|
|
is => 'ro', |
40
|
|
|
|
|
|
|
isa => Maybe[Str], |
41
|
|
|
|
|
|
|
lazy => 1, |
42
|
|
|
|
|
|
|
builder => '_build_cpanid', |
43
|
|
|
|
|
|
|
); |
44
|
|
|
|
|
|
|
|
45
|
|
|
|
|
|
|
sub _build_cpanid |
46
|
|
|
|
|
|
|
{ |
47
|
3
|
|
|
3
|
|
6
|
my $self = shift; |
48
|
3
|
50
|
|
|
|
98
|
return unless $self->has_rdf_about; |
49
|
3
|
100
|
|
|
|
97
|
return unless $self->rdf_about->is_resource; |
50
|
2
|
50
|
|
|
|
73
|
$self->rdf_about->uri =~ m{^http://purl\.org/NET/cpan-uri/person/(\w+)$} |
51
|
|
|
|
|
|
|
and return $1; |
52
|
0
|
|
|
|
|
0
|
return; |
53
|
|
|
|
|
|
|
} |
54
|
|
|
|
|
|
|
|
55
|
|
|
|
|
|
|
sub _build_mbox |
56
|
|
|
|
|
|
|
{ |
57
|
1
|
|
|
1
|
|
3
|
my $self = shift; |
58
|
1
|
50
|
|
|
|
25
|
return [sprintf('mailto:%s@cpan.org', $self->cpanid)] |
59
|
|
|
|
|
|
|
if defined $self->cpanid; |
60
|
0
|
|
|
|
|
0
|
return []; |
61
|
|
|
|
|
|
|
} |
62
|
|
|
|
|
|
|
|
63
|
|
|
|
|
|
|
sub to_string |
64
|
|
|
|
|
|
|
{ |
65
|
23
|
|
|
23
|
0
|
42
|
my $self = shift; |
66
|
|
|
|
|
|
|
|
67
|
23
|
100
|
0
|
|
|
122
|
return $self->name |
|
|
|
66
|
|
|
|
|
68
|
|
|
|
|
|
|
|| $self->nick |
69
|
|
|
|
|
|
|
|| $self->cpanid |
70
|
|
|
|
|
|
|
|| ($self->mbox && $self->mbox->[0]->uri) |
71
|
|
|
|
|
|
|
|| ($self->rdf_about && $self->rdf_about->uri) |
72
|
|
|
|
|
|
|
|| 'Anonymous' |
73
|
|
|
|
|
|
|
if @_ && $_[0] eq 'compact'; |
74
|
|
|
|
|
|
|
|
75
|
21
|
|
|
|
|
32
|
my @parts; |
76
|
21
|
50
|
|
|
|
572
|
if ($self->name) |
77
|
|
|
|
|
|
|
{ |
78
|
21
|
|
|
|
|
481
|
push @parts, $self->name; |
79
|
21
|
100
|
|
|
|
507
|
if ($self->cpanid) |
80
|
|
|
|
|
|
|
{ |
81
|
20
|
|
|
|
|
479
|
push @parts, sprintf('(%s)', uc $self->cpanid); |
82
|
|
|
|
|
|
|
} |
83
|
|
|
|
|
|
|
} |
84
|
|
|
|
|
|
|
else |
85
|
|
|
|
|
|
|
{ |
86
|
0
|
|
0
|
|
|
0
|
my $nick = uc($self->nick) || uc($self->cpanid); |
87
|
0
|
0
|
|
|
|
0
|
push @parts, $nick if $nick; |
88
|
|
|
|
|
|
|
} |
89
|
|
|
|
|
|
|
|
90
|
21
|
|
|
|
|
53
|
for my $mbox (@{$self->mbox}) |
|
21
|
|
|
|
|
503
|
|
91
|
|
|
|
|
|
|
{ |
92
|
21
|
50
|
33
|
|
|
74
|
if ($mbox and $mbox->uri =~ /^mailto:(.+)$/) |
93
|
|
|
|
|
|
|
{ |
94
|
21
|
|
|
|
|
858
|
push @parts, "<$1>"; |
95
|
21
|
|
|
|
|
46
|
last; |
96
|
|
|
|
|
|
|
} |
97
|
|
|
|
|
|
|
} |
98
|
|
|
|
|
|
|
|
99
|
21
|
|
|
|
|
38
|
for my $mbox (@{$self->mbox}) |
|
21
|
|
|
|
|
528
|
|
100
|
|
|
|
|
|
|
{ |
101
|
21
|
50
|
|
|
|
67
|
push @parts, $mbox if !@parts; |
102
|
|
|
|
|
|
|
} |
103
|
|
|
|
|
|
|
|
104
|
21
|
50
|
33
|
|
|
61
|
push @parts, $self->rdf_about if !@parts && $self->has_rdf_about; |
105
|
|
|
|
|
|
|
|
106
|
21
|
50
|
|
|
|
205
|
join(" ", grep !!$_, @parts) or 'Anonymous'; |
107
|
|
|
|
|
|
|
} |
108
|
|
|
|
|
|
|
|
109
|
|
|
|
|
|
|
1; |