| 1 | package Catmandu::Fix::Condition::is_archived_web_uri; | ||||||||||||||||||||||||||||
| 2 | |||||||||||||||||||||||||||||
| 3 | 1 | our $VERSION = '0.15'; | |||||||||||||||||||||||||||
| 4 | |||||||||||||||||||||||||||||
| 5 | 1 | ▶ | use Catmandu::Sane; | ||||||||||||||||||||||||||
|
Subroutine
BEGIN: called CC=1 SCAR=0.0
| |||||||||||||||||||||||||||||
| 6 | 1 | ▶ | use Moo; | ||||||||||||||||||||||||||
|
Subroutine
BEGIN: called CC=1 SCAR=0.0
| |||||||||||||||||||||||||||||
| 7 | 1 | ▶ | use Data::Validate::URI; | ||||||||||||||||||||||||||
|
Subroutine
BEGIN: called CC=1 SCAR=0.0
| |||||||||||||||||||||||||||||
| 8 | 1 | ▶ | use Memento::TimeTravel; | ||||||||||||||||||||||||||
|
Subroutine
BEGIN: called CC=1 SCAR=0.0
| |||||||||||||||||||||||||||||
| 9 | 1 | ▶ | use Catmandu::Fix::Has; | ||||||||||||||||||||||||||
|
Subroutine
BEGIN: called CC=1 SCAR=0.0
| |||||||||||||||||||||||||||||
| 10 | |||||||||||||||||||||||||||||
| 11 | 1 | has path => (fix_arg => 1); | |||||||||||||||||||||||||||
| 12 | 1 | has date => (fix_arg => 1); | |||||||||||||||||||||||||||
| 13 | |||||||||||||||||||||||||||||
| 14 | 1 | with 'Catmandu::Fix::Condition::SimpleAllTest'; | |||||||||||||||||||||||||||
| 15 | |||||||||||||||||||||||||||||
| 16 | 5 | ▶ | sub emit_test { | ||||||||||||||||||||||||||
|
Subroutine
emit_test: called CC=3 SCAR=12.0
Pod
undocumented
| |||||||||||||||||||||||||||||
| 17 | 5 | my ($self, $var) = @_; | |||||||||||||||||||||||||||
| 18 | 5 | my $date = $self->date; | |||||||||||||||||||||||||||
| 19 | 5 | ▶ | $date = [localtime]->[5] + 1900 unless defined($date) && length($date); | ||||||||||||||||||||||||||
|
Branch: 1 branch
Condition33%1/3
defined $date and length $date
MC/DC0%0/2
defined $date and length $date
defined $date
length $date
Truth table33%1/3
A and B
A= defined $dateB= length $date
| |||||||||||||||||||||||||||||
| 20 | |||||||||||||||||||||||||||||
| 21 | 5 | "(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 | 1; | |||||||||||||||||||||||||||