| line |
stmt |
bran |
cond |
sub |
pod |
time |
code |
|
1
|
|
|
|
|
|
|
# Copyright (c) 2023-2025 Philipp Schafft |
|
2
|
|
|
|
|
|
|
|
|
3
|
|
|
|
|
|
|
# licensed under Artistic License 2.0 (see LICENSE file) |
|
4
|
|
|
|
|
|
|
|
|
5
|
|
|
|
|
|
|
# ABSTRACT: format independent identifier object |
|
6
|
|
|
|
|
|
|
|
|
7
|
|
|
|
|
|
|
|
|
8
|
|
|
|
|
|
|
package Data::Identifier::Interface::Known; |
|
9
|
|
|
|
|
|
|
|
|
10
|
7
|
|
|
7
|
|
5347
|
use v5.20; |
|
|
7
|
|
|
|
|
28
|
|
|
11
|
7
|
|
|
7
|
|
38
|
use strict; |
|
|
7
|
|
|
|
|
14
|
|
|
|
7
|
|
|
|
|
183
|
|
|
12
|
7
|
|
|
7
|
|
29
|
use warnings; |
|
|
7
|
|
|
|
|
13
|
|
|
|
7
|
|
|
|
|
303
|
|
|
13
|
|
|
|
|
|
|
|
|
14
|
7
|
|
|
7
|
|
40
|
use Carp; |
|
|
7
|
|
|
|
|
15
|
|
|
|
7
|
|
|
|
|
767
|
|
|
15
|
7
|
|
|
7
|
|
48
|
use Data::Identifier; |
|
|
7
|
|
|
|
|
15
|
|
|
|
7
|
|
|
|
|
5786
|
|
|
16
|
|
|
|
|
|
|
|
|
17
|
|
|
|
|
|
|
our $VERSION = v0.28; |
|
18
|
|
|
|
|
|
|
|
|
19
|
|
|
|
|
|
|
my @_subobjects = qw(db extractor store fii); |
|
20
|
|
|
|
|
|
|
|
|
21
|
|
|
|
|
|
|
|
|
22
|
|
|
|
|
|
|
sub known { |
|
23
|
2
|
|
|
2
|
1
|
8
|
my ($pkg, $class, %opts) = @_; |
|
24
|
2
|
|
50
|
|
|
10
|
my $as = $opts{as} // 'raw'; |
|
25
|
2
|
|
|
|
|
5
|
my ($list, %extra) = eval {$pkg->_known_provider($class)}; |
|
|
2
|
|
|
|
|
10
|
|
|
26
|
2
|
|
|
|
|
5
|
my $listas = $opts{listas}; |
|
27
|
|
|
|
|
|
|
|
|
28
|
2
|
50
|
|
|
|
24
|
if (defined $list) { |
|
29
|
2
|
50
|
|
|
|
8
|
if ($extra{not_identifiers}) { |
|
30
|
0
|
0
|
|
|
|
0
|
if (!defined($listas)) { |
|
31
|
0
|
0
|
0
|
|
|
0
|
if ($as eq 'raw' || (defined($extra{rawtype}) && $as eq $extra{rawtype})) { |
|
|
|
|
0
|
|
|
|
|
|
32
|
0
|
|
|
|
|
0
|
return @{$list}; |
|
|
0
|
|
|
|
|
0
|
|
|
33
|
|
|
|
|
|
|
} |
|
34
|
|
|
|
|
|
|
} |
|
35
|
|
|
|
|
|
|
|
|
36
|
0
|
0
|
|
|
|
0
|
if ($opts{skip_invalid}) { |
|
37
|
|
|
|
|
|
|
# Let us try again with only identifiers: |
|
38
|
0
|
|
|
|
|
0
|
my @res; |
|
39
|
|
|
|
|
|
|
|
|
40
|
0
|
|
|
|
|
0
|
@res = grep {defined} map {eval {$_->Data::Identifier::as($as, %opts{@_subobjects, qw(no_defaults)}, %extra{qw(rawtype)})}} @{$list}; |
|
|
0
|
|
|
|
|
0
|
|
|
|
0
|
|
|
|
|
0
|
|
|
|
0
|
|
|
|
|
0
|
|
|
|
0
|
|
|
|
|
0
|
|
|
41
|
|
|
|
|
|
|
|
|
42
|
0
|
0
|
|
|
|
0
|
if (defined($listas)) { |
|
43
|
0
|
|
|
|
|
0
|
require Data::Identifier::Cloudlet; |
|
44
|
0
|
|
|
|
|
0
|
return Data::Identifier::Cloudlet->new(root => \@res, %opts{@_subobjects})->as($listas, %opts{@_subobjects}); |
|
45
|
|
|
|
|
|
|
} |
|
46
|
|
|
|
|
|
|
|
|
47
|
0
|
|
|
|
|
0
|
return @res; |
|
48
|
|
|
|
|
|
|
} |
|
49
|
|
|
|
|
|
|
} else { |
|
50
|
2
|
|
|
|
|
1
|
my @res; |
|
51
|
|
|
|
|
|
|
|
|
52
|
2
|
50
|
|
|
|
5
|
if ($opts{skip_invalid}) { |
|
53
|
0
|
|
|
|
|
0
|
@res = grep {defined} map {eval {$_->Data::Identifier::as($as, %opts{@_subobjects, qw(no_defaults)}, %extra{qw(rawtype)})}} @{$list}; |
|
|
0
|
|
|
|
|
0
|
|
|
|
0
|
|
|
|
|
0
|
|
|
|
0
|
|
|
|
|
0
|
|
|
|
0
|
|
|
|
|
0
|
|
|
54
|
|
|
|
|
|
|
} else { |
|
55
|
2
|
|
|
|
|
3
|
@res = map {$_->Data::Identifier::as($as, %opts{@_subobjects, qw(no_defaults)}, %extra{qw(rawtype)})} @{$list}; |
|
|
122
|
|
|
|
|
290
|
|
|
|
2
|
|
|
|
|
5
|
|
|
56
|
|
|
|
|
|
|
} |
|
57
|
|
|
|
|
|
|
|
|
58
|
2
|
50
|
|
|
|
7
|
if (defined($listas)) { |
|
59
|
0
|
|
|
|
|
0
|
require Data::Identifier::Cloudlet; |
|
60
|
0
|
|
|
|
|
0
|
return Data::Identifier::Cloudlet->new(root => \@res, %opts{@_subobjects})->as($listas, %opts{@_subobjects}); |
|
61
|
|
|
|
|
|
|
} |
|
62
|
|
|
|
|
|
|
|
|
63
|
2
|
|
|
|
|
19
|
return @res; |
|
64
|
|
|
|
|
|
|
} |
|
65
|
|
|
|
|
|
|
} |
|
66
|
|
|
|
|
|
|
|
|
67
|
0
|
0
|
|
|
|
|
return @{$opts{default}} if exists $opts{default}; |
|
|
0
|
|
|
|
|
|
|
|
68
|
0
|
|
|
|
|
|
croak 'Unsupported class or options'; |
|
69
|
|
|
|
|
|
|
} |
|
70
|
|
|
|
|
|
|
|
|
71
|
|
|
|
|
|
|
|
|
72
|
|
|
|
|
|
|
sub _known_provider { |
|
73
|
0
|
|
|
0
|
|
|
my ($pkg, $class, %opts) = @_; |
|
74
|
0
|
0
|
|
|
|
|
croak 'Unsupported options passed' if scalar(keys %opts); |
|
75
|
0
|
0
|
|
|
|
|
return ([]) if $class eq ':all'; |
|
76
|
0
|
|
|
|
|
|
croak 'Unsupported class'; |
|
77
|
|
|
|
|
|
|
} |
|
78
|
|
|
|
|
|
|
|
|
79
|
|
|
|
|
|
|
1; |
|
80
|
|
|
|
|
|
|
|
|
81
|
|
|
|
|
|
|
__END__ |