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
|
package Catmandu::Fix::Condition::is_live_web_uri;
our $VERSION = '0.15';
use Catmandu::Sane;
use Moo;
use Data::Validate::URI;
use LWP::Simple;
use Catmandu::Fix::Has;
has path => (fix_arg => 1);
with 'Catmandu::Fix::Condition::SimpleAllTest';
sub emit_test {
my ($self, $var) = @_;
"(is_value(${var}) && Data::Validate::URI::is_web_uri(${var}) && LWP::Simple::head(${var}))";
}
=head1 NAME
Catmandu::Fix::Condition::is_live_web_uri - check of a field contains an HTTP or HTTPS URI which is available online
=head1 SYNOPSIS
if is_live_web_uri(uri_field)
...
else
...
end
=head1 SEE ALSO
L<Catmandu::Fix>
=cut
1;
|