| 1 | package Enbld::Target::AttributeExtension::URL; | ||||||||||
| 2 | |||||||||||
| 3 | 8 | ▶ | use strict; | ||||||||
|
Subroutine
BEGIN: called CC=1 SCAR=0.0
| |||||||||||
| 4 | 8 | ▶ | use warnings; | ||||||||
|
Subroutine
BEGIN: called CC=1 SCAR=0.0
| |||||||||||
| 5 | |||||||||||
| 6 | 8 | ▶ | use Carp; | ||||||||
|
Subroutine
BEGIN: called CC=1 SCAR=0.0
| |||||||||||
| 7 | |||||||||||
| 8 | 8 | ▶ | use parent qw/Enbld::Target::AttributeExtension::Word/; | ||||||||
|
Subroutine
BEGIN: called CC=1 SCAR=0.0
| |||||||||||
| 9 | |||||||||||
| 10 | sub validate { | ||||||||||
| 11 | 208 | ▶ | my ( $self, $string ) = @_; | ||||||||
|
Subroutine
validate: called CC=2 SCAR=6.9
Pod
undocumented
| |||||||||||
| 12 | |||||||||||
| 13 | 208 | $self->SUPER::validate( $string ); | |||||||||
| 14 | |||||||||||
| 15 | 196 | my $pattern = q{s?https?://[-_.!~*'()a-zA-Z0-9;/?:@&=+$,%#]+}; | |||||||||
| 16 | |||||||||||
| 17 | 196 | ▶ | if ( $string !~ /^$pattern$/ ) { | ||||||||
|
Branch: 1 branch
| |||||||||||
| 18 | 4 | my $type = ref( $self ); | |||||||||
| 19 | 4 | $type =~ s/.*:://; | |||||||||
| 20 | 4 | require Enbld::Exception; | |||||||||
| 21 | 4 | croak( Enbld::Exception->new( | |||||||||
| 22 | "Attribute '$type' isn't valid URL string", $string | ||||||||||
| 23 | )); | ||||||||||
| 24 | } | ||||||||||
| 25 | } | ||||||||||
| 26 | |||||||||||
| 27 | 8 | 1; | |||||||||
| 28 | |||||||||||