File: orcid_find.pm

package info (click to toggle)
libcatmandu-identifier-perl 0.15-2
  • links: PTS, VCS
  • area: main
  • in suites: bookworm, forky, sid, trixie
  • size: 292 kB
  • sloc: perl: 978; makefile: 2
file content (42 lines) | stat: -rw-r--r-- 732 bytes parent folder | download
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
package Catmandu::Fix::orcid_find;

our $VERSION = '0.15';

use Catmandu::Sane;
use Moo;
use WWW::ORCID;
use Catmandu::Fix::Has;

has path => (fix_arg => 1);

with 'Catmandu::Fix::SimpleGetValue';

sub emit_value {
    my ($self, $var) = @_;

    "${var} = WWW::ORCID::API::Pub->new->search_bio(${var}) if is_hash_ref(${var});";
}

=head1 NAME

Catmandu::Fix::orcid_find - find an ORCID id for a query

=head1 SYNOPSIS

   # Find ORCID bio for a query
   # query:
   #     q: "Johson"
   orcid_find(query)

   if exists(orcid.orcid-search-results.num-found)
       copy_field(orcid.orcid-search-results.orcid-search-result.0.orcid-profile.orcid-identifier.path,id)
   end

=head1 SEE ALSO

L<Catmandu::Fix>,
L<WWW::ORCID>

=cut

1;