| line |
stmt |
bran |
cond |
sub |
pod |
time |
code |
|
1
|
|
|
|
|
|
|
package Module::CheckVersion::AuthorityScheme::cpan; |
|
2
|
|
|
|
|
|
|
|
|
3
|
1
|
|
|
1
|
|
222664
|
use 5.010001; |
|
|
1
|
|
|
|
|
3
|
|
|
4
|
1
|
|
|
1
|
|
4
|
use strict; |
|
|
1
|
|
|
|
|
2
|
|
|
|
1
|
|
|
|
|
19
|
|
|
5
|
1
|
|
|
1
|
|
3
|
use warnings; |
|
|
1
|
|
|
|
|
6
|
|
|
|
1
|
|
|
|
|
49
|
|
|
6
|
|
|
|
|
|
|
|
|
7
|
1
|
|
|
1
|
|
1996
|
use HTTP::Tiny; |
|
|
1
|
|
|
|
|
43166
|
|
|
|
1
|
|
|
|
|
37
|
|
|
8
|
1
|
|
|
1
|
|
389
|
use JSON::MaybeXS; |
|
|
1
|
|
|
|
|
7259
|
|
|
|
1
|
|
|
|
|
203
|
|
|
9
|
|
|
|
|
|
|
|
|
10
|
|
|
|
|
|
|
our $AUTHORITY = 'cpan:PERLANCAR'; # AUTHORITY |
|
11
|
|
|
|
|
|
|
our $DATE = '2026-04-08'; # DATE |
|
12
|
|
|
|
|
|
|
our $DIST = 'Module-CheckVersion'; # DIST |
|
13
|
|
|
|
|
|
|
our $VERSION = '0.091'; # VERSION |
|
14
|
|
|
|
|
|
|
|
|
15
|
|
|
|
|
|
|
sub check_latest_version { |
|
16
|
0
|
|
|
0
|
0
|
|
my ($mod, $authority_scheme, $authority_content) = @_; |
|
17
|
|
|
|
|
|
|
|
|
18
|
0
|
|
|
|
|
|
my $res = HTTP::Tiny->new->get("http://fastapi.metacpan.org/v1/module/$mod?fields=name,version"); |
|
19
|
0
|
0
|
|
|
|
|
return [$res->{status}, "API request failed: $res->{reason}"] unless $res->{success}; |
|
20
|
0
|
|
|
|
|
|
eval { $res = JSON::MaybeXS::decode_json($res->{content}) }; |
|
|
0
|
|
|
|
|
|
|
|
21
|
0
|
0
|
|
|
|
|
return [500, "Can't decode JSON API response: $@"] if $@; |
|
22
|
0
|
0
|
|
|
|
|
return [500, "Error from API response: $res->{message}"] if $res->{message}; |
|
23
|
0
|
|
|
|
|
|
[200, "OK", $res->{version}]; |
|
24
|
|
|
|
|
|
|
} |
|
25
|
|
|
|
|
|
|
|
|
26
|
|
|
|
|
|
|
1; |
|
27
|
|
|
|
|
|
|
# ABSTRACT: Handler for "cpan" authority scheme |
|
28
|
|
|
|
|
|
|
|
|
29
|
|
|
|
|
|
|
__END__ |