File Coverage

blib/lib/WebService/MinFraud/Data/Rx/Type/WebURI.pm
Criterion Covered Total %
statement 24 24 100.0
branch 2 2 100.0
condition 2 3 66.6
subroutine 9 9 100.0
pod 0 2 0.0
total 37 40 92.5


line stmt bran cond sub pod time code
1             package WebService::MinFraud::Data::Rx::Type::WebURI;
2              
3 2     2   34 use 5.010;
  2         7  
4              
5 2     2   12 use strict;
  2         5  
  2         35  
6 2     2   9 use warnings;
  2         5  
  2         46  
7 2     2   10 use namespace::autoclean;
  2         14  
  2         11  
8              
9             our $VERSION = '1.010000';
10              
11 2     2   1044 use Data::Validate::URI qw(is_web_uri);
  2         1663  
  2         101  
12              
13 2     2   16 use parent 'Data::Rx::CommonType::EasyNew';
  2         4  
  2         11  
14              
15 2     2   104 use Role::Tiny::With;
  2         4  
  2         249  
16              
17             with 'WebService::MinFraud::Role::Data::Rx::Type';
18              
19             sub assert_valid {
20 2     2 0 305 my ( $self, $value ) = @_;
21              
22 2 100 66     48 return 1
23             if $value
24             && is_web_uri($value);
25              
26 1         219 $self->fail(
27             {
28             error => [qw(type)],
29             message => 'Found value is not a valid Web URI.',
30             value => $value,
31             }
32             );
33             }
34              
35             sub type_uri {
36             ## no critic(ValuesAndExpressions::ProhibitCommaSeparatedStatements)
37 42     42 0 685 'tag:maxmind.com,MAXMIND:rx/weburi';
38             }
39              
40             1;
41              
42             # ABSTRACT: A type to check for a valid Web URI
43              
44             __END__
45              
46             =pod
47              
48             =encoding UTF-8
49              
50             =head1 NAME
51              
52             WebService::MinFraud::Data::Rx::Type::WebURI - A type to check for a valid Web URI
53              
54             =head1 VERSION
55              
56             version 1.010000
57              
58             =head1 SUPPORT
59              
60             Bugs may be submitted through L<https://github.com/maxmind/minfraud-api-perl/issues>.
61              
62             =head1 AUTHOR
63              
64             Mateu Hunter <mhunter@maxmind.com>
65              
66             =head1 COPYRIGHT AND LICENSE
67              
68             This software is copyright (c) 2015 - 2020 by MaxMind, Inc.
69              
70             This is free software; you can redistribute it and/or modify it under
71             the same terms as the Perl 5 programming language system itself.
72              
73             =cut