line |
stmt |
bran |
cond |
sub |
pod |
time |
code |
1
|
|
|
|
|
|
|
package App::Kramerius::URI; |
2
|
|
|
|
|
|
|
|
3
|
4
|
|
|
4
|
|
82377
|
use strict; |
|
4
|
|
|
|
|
25
|
|
|
4
|
|
|
|
|
117
|
|
4
|
4
|
|
|
4
|
|
18
|
use warnings; |
|
4
|
|
|
|
|
9
|
|
|
4
|
|
|
|
|
99
|
|
5
|
|
|
|
|
|
|
|
6
|
4
|
|
|
4
|
|
1935
|
use Data::Kramerius; |
|
4
|
|
|
|
|
22826
|
|
|
4
|
|
|
|
|
116
|
|
7
|
4
|
|
|
4
|
|
8020
|
use Getopt::Std; |
|
4
|
|
|
|
|
245
|
|
|
4
|
|
|
|
|
1211
|
|
8
|
|
|
|
|
|
|
|
9
|
|
|
|
|
|
|
our $VERSION = 0.02; |
10
|
|
|
|
|
|
|
|
11
|
|
|
|
|
|
|
# Constructor. |
12
|
|
|
|
|
|
|
sub new { |
13
|
3
|
|
|
3
|
1
|
4060
|
my ($class, @params) = @_; |
14
|
|
|
|
|
|
|
|
15
|
|
|
|
|
|
|
# Create object. |
16
|
3
|
|
|
|
|
10
|
my $self = bless {}, $class; |
17
|
|
|
|
|
|
|
|
18
|
|
|
|
|
|
|
# Load data. |
19
|
3
|
|
|
|
|
42
|
$self->{'kramerius'} = Data::Kramerius->new; |
20
|
|
|
|
|
|
|
|
21
|
|
|
|
|
|
|
# Object. |
22
|
3
|
|
|
|
|
6317
|
return $self; |
23
|
|
|
|
|
|
|
} |
24
|
|
|
|
|
|
|
|
25
|
|
|
|
|
|
|
# Run. |
26
|
|
|
|
|
|
|
sub run { |
27
|
2
|
|
|
2
|
1
|
8
|
my $self = shift; |
28
|
|
|
|
|
|
|
|
29
|
|
|
|
|
|
|
# Process arguments. |
30
|
2
|
|
|
|
|
8
|
$self->{'_opts'} = { |
31
|
|
|
|
|
|
|
'h' => 0, |
32
|
|
|
|
|
|
|
}; |
33
|
2
|
100
|
66
|
|
|
13
|
if (! getopts('h', $self->{'_opts'}) || @ARGV < 1 |
|
|
|
66
|
|
|
|
|
34
|
|
|
|
|
|
|
|| $self->{'_opts'}->{'h'}) { |
35
|
|
|
|
|
|
|
|
36
|
1
|
|
|
|
|
114
|
print STDERR "Usage: $0 [-h] [--version] kramerius_id\n"; |
37
|
1
|
|
|
|
|
14
|
print STDERR "\t-h\t\tHelp.\n"; |
38
|
1
|
|
|
|
|
12
|
print STDERR "\t--version\tPrint version.\n"; |
39
|
1
|
|
|
|
|
11
|
print STDERR "\tkramerius_id\tKramerius system id. e.g. ". |
40
|
|
|
|
|
|
|
"mzk\n"; |
41
|
1
|
|
|
|
|
6
|
return 1; |
42
|
|
|
|
|
|
|
} |
43
|
1
|
|
|
|
|
43
|
my $kramerius_id = shift @ARGV; |
44
|
|
|
|
|
|
|
|
45
|
1
|
|
|
|
|
9
|
my $kramerius_obj = $self->{'kramerius'}->get($kramerius_id); |
46
|
|
|
|
|
|
|
|
47
|
|
|
|
|
|
|
# Print URL. |
48
|
1
|
50
|
|
|
|
108
|
if (defined $kramerius_obj) { |
49
|
1
|
|
|
|
|
4
|
print $kramerius_obj->url.' '.$kramerius_obj->version."\n"; |
50
|
|
|
|
|
|
|
} |
51
|
|
|
|
|
|
|
|
52
|
1
|
|
|
|
|
121
|
return 0; |
53
|
|
|
|
|
|
|
} |
54
|
|
|
|
|
|
|
|
55
|
|
|
|
|
|
|
1; |
56
|
|
|
|
|
|
|
|
57
|
|
|
|
|
|
|
=pod |
58
|
|
|
|
|
|
|
|
59
|
|
|
|
|
|
|
=encoding utf8 |
60
|
|
|
|
|
|
|
|
61
|
|
|
|
|
|
|
=head1 NAME |
62
|
|
|
|
|
|
|
|
63
|
|
|
|
|
|
|
App::Kramerius::URI - Base class for kramerius-uri script. |
64
|
|
|
|
|
|
|
|
65
|
|
|
|
|
|
|
=head1 SYNOPSIS |
66
|
|
|
|
|
|
|
|
67
|
|
|
|
|
|
|
use App::Kramerius::URI; |
68
|
|
|
|
|
|
|
|
69
|
|
|
|
|
|
|
my $app = App::Kramerius::URI->new; |
70
|
|
|
|
|
|
|
my $exit_code = $app->run; |
71
|
|
|
|
|
|
|
|
72
|
|
|
|
|
|
|
=head1 METHODS |
73
|
|
|
|
|
|
|
|
74
|
|
|
|
|
|
|
=head2 C<new> |
75
|
|
|
|
|
|
|
|
76
|
|
|
|
|
|
|
my $app = App::Kramerius::URI->new; |
77
|
|
|
|
|
|
|
|
78
|
|
|
|
|
|
|
Constructor. |
79
|
|
|
|
|
|
|
|
80
|
|
|
|
|
|
|
Returns instance of object. |
81
|
|
|
|
|
|
|
|
82
|
|
|
|
|
|
|
=head2 C<run> |
83
|
|
|
|
|
|
|
|
84
|
|
|
|
|
|
|
my $exit_code = $app->run; |
85
|
|
|
|
|
|
|
|
86
|
|
|
|
|
|
|
Run. |
87
|
|
|
|
|
|
|
|
88
|
|
|
|
|
|
|
Returns 1 for error, 0 for success. |
89
|
|
|
|
|
|
|
|
90
|
|
|
|
|
|
|
=head1 EXAMPLE |
91
|
|
|
|
|
|
|
|
92
|
|
|
|
|
|
|
use strict; |
93
|
|
|
|
|
|
|
use warnings; |
94
|
|
|
|
|
|
|
|
95
|
|
|
|
|
|
|
use App::Kramerius::URI; |
96
|
|
|
|
|
|
|
|
97
|
|
|
|
|
|
|
# Arguments. |
98
|
|
|
|
|
|
|
@ARGV = ( |
99
|
|
|
|
|
|
|
'mzk', |
100
|
|
|
|
|
|
|
); |
101
|
|
|
|
|
|
|
|
102
|
|
|
|
|
|
|
# Run. |
103
|
|
|
|
|
|
|
exit App::Kramerius::URI->new->run; |
104
|
|
|
|
|
|
|
|
105
|
|
|
|
|
|
|
# Output like: |
106
|
|
|
|
|
|
|
# http://kramerius.mzk.cz/ 4 |
107
|
|
|
|
|
|
|
|
108
|
|
|
|
|
|
|
=head1 DEPENDENCIES |
109
|
|
|
|
|
|
|
|
110
|
|
|
|
|
|
|
L<Data::Kramerius>, |
111
|
|
|
|
|
|
|
L<Getopt::Std>. |
112
|
|
|
|
|
|
|
|
113
|
|
|
|
|
|
|
=head1 REPOSITORY |
114
|
|
|
|
|
|
|
|
115
|
|
|
|
|
|
|
L<https://github.com/michal-josef-spacek/App-Kramerius-URI> |
116
|
|
|
|
|
|
|
|
117
|
|
|
|
|
|
|
=head1 AUTHOR |
118
|
|
|
|
|
|
|
|
119
|
|
|
|
|
|
|
Michal Josef Špaček L<mailto:skim@cpan.org> |
120
|
|
|
|
|
|
|
|
121
|
|
|
|
|
|
|
L<http://skim.cz> |
122
|
|
|
|
|
|
|
|
123
|
|
|
|
|
|
|
=head1 LICENSE AND COPYRIGHT |
124
|
|
|
|
|
|
|
|
125
|
|
|
|
|
|
|
© 2021 Michal Josef Špaček |
126
|
|
|
|
|
|
|
|
127
|
|
|
|
|
|
|
BSD 2-Clause License |
128
|
|
|
|
|
|
|
|
129
|
|
|
|
|
|
|
=head1 VERSION |
130
|
|
|
|
|
|
|
|
131
|
|
|
|
|
|
|
0.02 |
132
|
|
|
|
|
|
|
|
133
|
|
|
|
|
|
|
=cut |