File Coverage

blib/lib/Catmandu/Fix/orcid_find.pm
Criterion Covered Total %
statement 12 14 85.7
branch n/a
condition n/a
subroutine 4 5 80.0
pod 0 1 0.0
total 16 20 80.0


line stmt bran cond sub pod time code
1             package Catmandu::Fix::orcid_find;
2              
3             our $VERSION = '0.14';
4              
5 1     1   85333 use Catmandu::Sane;
  1         160388  
  1         7  
6 1     1   266 use Moo;
  1         2  
  1         5  
7 1     1   754 use WWW::ORCID;
  1         3415  
  1         24  
8 1     1   353 use Catmandu::Fix::Has;
  1         769  
  1         5  
9              
10             has path => (fix_arg => 1);
11              
12             with 'Catmandu::Fix::SimpleGetValue';
13              
14             sub emit_value {
15 0     0 0   my ($self, $var) = @_;
16              
17 0           "${var} = WWW::ORCID::API::Pub->new->search_bio(${var}) if is_hash_ref(${var});";
18             }
19              
20             =head1 NAME
21              
22             Catmandu::Fix::orcid_find - find an ORCID id for a query
23              
24             =head1 SYNOPSIS
25              
26             # Find ORCID bio for a query
27             # query:
28             # q: "Johson"
29             orcid_find(query)
30              
31             if exists(orcid.orcid-search-results.num-found)
32             copy_field(orcid.orcid-search-results.orcid-search-result.0.orcid-profile.orcid-identifier.path,id)
33             end
34              
35             =head1 SEE ALSO
36              
37             L<Catmandu::Fix>,
38             L<WWW::ORCID>
39              
40             =cut
41              
42             1;