line |
stmt |
bran |
cond |
sub |
pod |
time |
code |
1
|
|
|
|
|
|
|
package RDF::DOAP::Utils; |
2
|
|
|
|
|
|
|
|
3
|
|
|
|
|
|
|
our $AUTHORITY = 'cpan:TOBYINK'; |
4
|
|
|
|
|
|
|
our $VERSION = '0.104'; |
5
|
|
|
|
|
|
|
|
6
|
2
|
|
|
2
|
|
15
|
use strict; |
|
2
|
|
|
|
|
4
|
|
|
2
|
|
|
|
|
69
|
|
7
|
2
|
|
|
2
|
|
20
|
use warnings; |
|
2
|
|
|
|
|
3
|
|
|
2
|
|
|
|
|
72
|
|
8
|
|
|
|
|
|
|
|
9
|
2
|
|
|
2
|
|
12
|
use RDF::DOAP::Types -types; |
|
2
|
|
|
|
|
4
|
|
|
2
|
|
|
|
|
25
|
|
10
|
2
|
|
|
2
|
|
11659
|
use match::simple 'match'; |
|
2
|
|
|
|
|
4226
|
|
|
2
|
|
|
|
|
17
|
|
11
|
2
|
|
|
2
|
|
412
|
use List::Util 'uniq'; |
|
2
|
|
|
|
|
5
|
|
|
2
|
|
|
|
|
236
|
|
12
|
|
|
|
|
|
|
|
13
|
|
|
|
|
|
|
use MooseX::AttributeTags ( |
14
|
|
|
|
|
|
|
WithURI => [ |
15
|
|
|
|
|
|
|
uri => [ is => 'ro', isa => Identifier, coerce => 1, required => 1 ], |
16
|
|
|
|
|
|
|
multi => [ is => 'ro', isa => Bool, default => 0 ], |
17
|
|
|
|
|
|
|
], |
18
|
|
|
|
|
|
|
Gathering => [ |
19
|
2
|
|
|
|
|
12
|
gather_as => [ is => 'ro', isa => ArrayRef[Str], default => sub { [] } ], |
|
0
|
|
|
|
|
0
|
|
20
|
|
|
|
|
|
|
], |
21
|
2
|
|
|
2
|
|
917
|
); |
|
2
|
|
|
|
|
1960
|
|
22
|
|
|
|
|
|
|
|
23
|
2
|
|
|
2
|
|
269605
|
use Exporter::Tiny (); |
|
2
|
|
|
|
|
5
|
|
|
2
|
|
|
|
|
939
|
|
24
|
|
|
|
|
|
|
our @ISA = qw( Exporter::Tiny ); |
25
|
|
|
|
|
|
|
our @EXPORT_OK = qw( WithURI Gathering ); |
26
|
|
|
|
|
|
|
our %EXPORT_TAGS = ( |
27
|
|
|
|
|
|
|
traits => [qw( WithURI Gathering )] |
28
|
|
|
|
|
|
|
); |
29
|
|
|
|
|
|
|
|
30
|
|
|
|
|
|
|
our %seen; |
31
|
|
|
|
|
|
|
|
32
|
|
|
|
|
|
|
sub _gather_objects |
33
|
|
|
|
|
|
|
{ |
34
|
0
|
|
|
0
|
|
|
my ($self, $relation) = @_; |
35
|
0
|
0
|
|
|
|
|
return if $seen{$self}++; |
36
|
|
|
|
|
|
|
|
37
|
0
|
0
|
|
|
|
|
if (ArrayRef->check($self)) |
38
|
|
|
|
|
|
|
{ |
39
|
0
|
|
|
|
|
|
return uniq( |
40
|
|
|
|
|
|
|
grep defined, map _gather_objects($_, $relation), grep defined, @$self |
41
|
|
|
|
|
|
|
); |
42
|
|
|
|
|
|
|
} |
43
|
|
|
|
|
|
|
|
44
|
0
|
0
|
|
|
|
|
if (Object->check($self)) |
45
|
|
|
|
|
|
|
{ |
46
|
0
|
0
|
|
|
|
|
return unless $self->isa('Moose::Object'); |
47
|
|
|
|
|
|
|
|
48
|
0
|
0
|
0
|
|
|
|
my @local = |
49
|
|
|
|
|
|
|
grep defined, |
50
|
|
|
|
|
|
|
map ArrayRef->check($_) ? @$_ : $_, |
51
|
|
|
|
|
|
|
map $_->get_value($self), |
52
|
|
|
|
|
|
|
grep $_->does(Gathering) && match($relation, $_->gather_as), |
53
|
|
|
|
|
|
|
$self->meta->get_all_attributes; |
54
|
|
|
|
|
|
|
|
55
|
0
|
|
0
|
|
|
|
my @recursive = |
56
|
|
|
|
|
|
|
grep defined, |
57
|
|
|
|
|
|
|
map _gather_objects($_, $relation), |
58
|
|
|
|
|
|
|
grep defined, |
59
|
|
|
|
|
|
|
map $_->get_value($self), |
60
|
|
|
|
|
|
|
grep !($_->does(Gathering) && match($relation, $_->gather_as)), |
61
|
|
|
|
|
|
|
$self->meta->get_all_attributes; |
62
|
|
|
|
|
|
|
|
63
|
0
|
|
|
|
|
|
return uniq(@local, @recursive); |
64
|
|
|
|
|
|
|
} |
65
|
|
|
|
|
|
|
} |
66
|
|
|
|
|
|
|
|
67
|
|
|
|
|
|
|
sub gather_objects |
68
|
|
|
|
|
|
|
{ |
69
|
0
|
|
|
0
|
0
|
|
local %seen; |
70
|
0
|
|
|
|
|
|
grep ref, _gather_objects(@_); |
71
|
|
|
|
|
|
|
} |
72
|
|
|
|
|
|
|
|
73
|
|
|
|
|
|
|
1; |