line |
stmt |
bran |
cond |
sub |
pod |
time |
code |
1
|
|
|
|
|
|
|
package Catmandu::Fix::Condition::is_archived_web_uri; |
2
|
|
|
|
|
|
|
|
3
|
|
|
|
|
|
|
our $VERSION = '0.13'; |
4
|
|
|
|
|
|
|
|
5
|
1
|
|
|
1
|
|
390466
|
use Catmandu::Sane; |
|
1
|
|
|
|
|
8
|
|
|
1
|
|
|
|
|
8
|
|
6
|
1
|
|
|
1
|
|
201
|
use Moo; |
|
1
|
|
|
|
|
2
|
|
|
1
|
|
|
|
|
8
|
|
7
|
1
|
|
|
1
|
|
783
|
use Data::Validate::URI; |
|
1
|
|
|
|
|
37864
|
|
|
1
|
|
|
|
|
43
|
|
8
|
1
|
|
|
1
|
|
399
|
use Memento::TimeTravel; |
|
1
|
|
|
|
|
4
|
|
|
1
|
|
|
|
|
34
|
|
9
|
1
|
|
|
1
|
|
8
|
use Catmandu::Fix::Has; |
|
1
|
|
|
|
|
2
|
|
|
1
|
|
|
|
|
9
|
|
10
|
|
|
|
|
|
|
|
11
|
|
|
|
|
|
|
has path => (fix_arg => 1); |
12
|
|
|
|
|
|
|
has date => (fix_arg => 1); |
13
|
|
|
|
|
|
|
|
14
|
|
|
|
|
|
|
with 'Catmandu::Fix::Condition::SimpleAllTest'; |
15
|
|
|
|
|
|
|
|
16
|
|
|
|
|
|
|
sub emit_test { |
17
|
5
|
|
|
5
|
0
|
23456
|
my ($self, $var) = @_; |
18
|
5
|
|
|
|
|
16
|
my $date = $self->date; |
19
|
5
|
50
|
33
|
|
|
25
|
$date = [localtime]->[5] + 1900 unless defined($date) && length($date); |
20
|
|
|
|
|
|
|
|
21
|
5
|
|
|
|
|
25
|
"(is_value(${var}) && Data::Validate::URI::is_web_uri(${var}) && Memento::TimeTravel::find_mementos(${var},${date}))"; |
22
|
|
|
|
|
|
|
} |
23
|
|
|
|
|
|
|
|
24
|
|
|
|
|
|
|
=head1 NAME |
25
|
|
|
|
|
|
|
|
26
|
|
|
|
|
|
|
Catmandu::Fix::Condition::is_archived_web_uri - check of a field contains an HTTP or HTTPS URI which is archived in a web archive |
27
|
|
|
|
|
|
|
|
28
|
|
|
|
|
|
|
=head1 SYNOPSIS |
29
|
|
|
|
|
|
|
|
30
|
|
|
|
|
|
|
# Check if an archived version is available for any year... |
31
|
|
|
|
|
|
|
if is_archived_web_uri(uri_field,'') |
32
|
|
|
|
|
|
|
... |
33
|
|
|
|
|
|
|
else |
34
|
|
|
|
|
|
|
... |
35
|
|
|
|
|
|
|
end |
36
|
|
|
|
|
|
|
|
37
|
|
|
|
|
|
|
# Check if an archived version is available for a year... |
38
|
|
|
|
|
|
|
if is_archived_web_uri(uri_field,2013) |
39
|
|
|
|
|
|
|
... |
40
|
|
|
|
|
|
|
else |
41
|
|
|
|
|
|
|
... |
42
|
|
|
|
|
|
|
end |
43
|
|
|
|
|
|
|
|
44
|
|
|
|
|
|
|
=head1 SEE ALSO |
45
|
|
|
|
|
|
|
|
46
|
|
|
|
|
|
|
L<Catmandu::Fix> |
47
|
|
|
|
|
|
|
|
48
|
|
|
|
|
|
|
=cut |
49
|
|
|
|
|
|
|
|
50
|
|
|
|
|
|
|
1; |