| 1 | package HTML::TagUtil; | ||||||||||||||||||||||||||||||||||
| 2 | |||||||||||||||||||||||||||||||||||
| 3 | ##HTML::TagUtil | ||||||||||||||||||||||||||||||||||
| 4 | |||||||||||||||||||||||||||||||||||
| 5 | 1 | ▶ | use 5.008001; #Need 5.8.1. | ||||||||||||||||||||||||||||||||
|
Subroutine
BEGIN: called CC=1 SCAR=0.0
| |||||||||||||||||||||||||||||||||||
| 6 | 1 | ▶ | use strict; | ||||||||||||||||||||||||||||||||
|
Subroutine
BEGIN: called CC=1 SCAR=0.0
| |||||||||||||||||||||||||||||||||||
| 7 | 1 | ▶ | use warnings; | ||||||||||||||||||||||||||||||||
|
Subroutine
BEGIN: called CC=1 SCAR=0.0
| |||||||||||||||||||||||||||||||||||
| 8 | |||||||||||||||||||||||||||||||||||
| 9 | 1 | require Exporter; | |||||||||||||||||||||||||||||||||
| 10 | 1 | ▶ | use AutoLoader qw(AUTOLOAD); | ||||||||||||||||||||||||||||||||
|
Subroutine
BEGIN: called CC=1 SCAR=0.0
| |||||||||||||||||||||||||||||||||||
| 11 | |||||||||||||||||||||||||||||||||||
| 12 | 1 | our @ISA = qw(Exporter); | |||||||||||||||||||||||||||||||||
| 13 | |||||||||||||||||||||||||||||||||||
| 14 | 1 | our %EXPORT_TAGS = ( 'all' => [ qw( | |||||||||||||||||||||||||||||||||
| 15 | tagged | ||||||||||||||||||||||||||||||||||
| 16 | opentagged | ||||||||||||||||||||||||||||||||||
| 17 | closetagged | ||||||||||||||||||||||||||||||||||
| 18 | tagpos | ||||||||||||||||||||||||||||||||||
| 19 | string | ||||||||||||||||||||||||||||||||||
| 20 | comment | ||||||||||||||||||||||||||||||||||
| 21 | ) ] ); | ||||||||||||||||||||||||||||||||||
| 22 | |||||||||||||||||||||||||||||||||||
| 23 | 1 | our @EXPORT_OK = ( @{ $EXPORT_TAGS{'all'} } ); #allow all public methods to export. | |||||||||||||||||||||||||||||||||
| 24 | |||||||||||||||||||||||||||||||||||
| 25 | |||||||||||||||||||||||||||||||||||
| 26 | |||||||||||||||||||||||||||||||||||
| 27 | 1 | our $VERSION = '1.43'; | |||||||||||||||||||||||||||||||||
| 28 | |||||||||||||||||||||||||||||||||||
| 29 | ##package variable to set whether to allow hyphens in comments. | ||||||||||||||||||||||||||||||||||
| 30 | ##Note: this is a *hack* to avoid having to deal with putting it in the | ||||||||||||||||||||||||||||||||||
| 31 | ##invocant's hashref here. (Couldn't figure out how to do it right. :-) | ||||||||||||||||||||||||||||||||||
| 32 | ## still looks the same to the user though, if they call the allow_hyphen | ||||||||||||||||||||||||||||||||||
| 33 | ##method. | ||||||||||||||||||||||||||||||||||
| 34 | 1 | our $Allow_Hyphen = 0; | |||||||||||||||||||||||||||||||||
| 35 | |||||||||||||||||||||||||||||||||||
| 36 | |||||||||||||||||||||||||||||||||||
| 37 | |||||||||||||||||||||||||||||||||||
| 38 | #$file will someday be available for checking. | ||||||||||||||||||||||||||||||||||
| 39 | #my $file; | ||||||||||||||||||||||||||||||||||
| 40 | |||||||||||||||||||||||||||||||||||
| 41 | ########################### | ||||||||||||||||||||||||||||||||||
| 42 | #####Class Constructor##### | ||||||||||||||||||||||||||||||||||
| 43 | ########################### | ||||||||||||||||||||||||||||||||||
| 44 | |||||||||||||||||||||||||||||||||||
| 45 | 0 | ▶ | sub new { | ||||||||||||||||||||||||||||||||
|
Subroutine
new: not called CC=3 SCAR=24.8
Pod
documented
| |||||||||||||||||||||||||||||||||||
| 46 | 0 | my $self = { | |||||||||||||||||||||||||||||||||
| 47 | string => shift, | ||||||||||||||||||||||||||||||||||
| 48 | tag => shift, | ||||||||||||||||||||||||||||||||||
| 49 | }; | ||||||||||||||||||||||||||||||||||
| 50 | |||||||||||||||||||||||||||||||||||
| 51 | 0 | ▶ | $self->{string } ||= ''; | ||||||||||||||||||||||||||||||||
|
Condition0%0/2
$self->{"string"} ||= ""
MC/DC0%0/1
$self->{"string"} ||= ""
$self->{"string"}
Truth table0%0/2
A
A= $self->{"string"}
| |||||||||||||||||||||||||||||||||||
| 52 | 0 | ▶ | $self->{tag } ||= ''; | ||||||||||||||||||||||||||||||||
|
Condition0%0/2
$self->{"tag"} ||= ""
MC/DC0%0/1
$self->{"tag"} ||= ""
$self->{"tag"}
Truth table0%0/2
A
A= $self->{"tag"}
| |||||||||||||||||||||||||||||||||||
| 53 | # $file = shift; | ||||||||||||||||||||||||||||||||||
| 54 | 0 | bless $self, 'HTML::TagUtil'; | |||||||||||||||||||||||||||||||||
| 55 | 0 | return $self; | |||||||||||||||||||||||||||||||||
| 56 | } | ||||||||||||||||||||||||||||||||||
| 57 | |||||||||||||||||||||||||||||||||||
| 58 | #################################### | ||||||||||||||||||||||||||||||||||
| 59 | ##########PRIVATE METHODS########### | ||||||||||||||||||||||||||||||||||
| 60 | #################################### | ||||||||||||||||||||||||||||||||||
| 61 | |||||||||||||||||||||||||||||||||||
| 62 | ## | ||||||||||||||||||||||||||||||||||
| 63 | ## Private method that does the actual matching for tagged. | ||||||||||||||||||||||||||||||||||
| 64 | ## | ||||||||||||||||||||||||||||||||||
| 65 | |||||||||||||||||||||||||||||||||||
| 66 | 0 | ▶ | sub _is_fully_tagged { | ||||||||||||||||||||||||||||||||
|
Subroutine
_is_fully_tagged: not called CC=5 SCAR=34.0
| |||||||||||||||||||||||||||||||||||
| 67 | 0 | my $self = shift; | |||||||||||||||||||||||||||||||||
| 68 | 0 | ▶ | my $arg = shift || $_; | ||||||||||||||||||||||||||||||||
|
Condition0%0/3
shift() || $_
MC/DC0%0/2
shift() || $_
shift()
$_
Truth table0%0/3
A || B
A= shift()B= $_
| |||||||||||||||||||||||||||||||||||
| 69 | 0 | ▶ | if ($arg =~ /<(([a-zA-Z])+((\s+\w+)=?("?\w+"?)?){0,})( (\/)?)?\s*>.*<\/(([a-zA-Z])+((\s+\w+)=?("?\w+"?)?){0,})( (\/)?)?\s*/) { | ||||||||||||||||||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||||||||||||||||||
| 70 | 0 | return 1; | |||||||||||||||||||||||||||||||||
| 71 | } else { | ||||||||||||||||||||||||||||||||||
| 72 | 0 | return 0; | |||||||||||||||||||||||||||||||||
| 73 | } | ||||||||||||||||||||||||||||||||||
| 74 | 0 | ▶ | $_ = $arg if ($arg); | ||||||||||||||||||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||||||||||||||||||
| 75 | 0 | ▶ | $self->{string} = $arg if ($arg); | ||||||||||||||||||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||||||||||||||||||
| 76 | } | ||||||||||||||||||||||||||||||||||
| 77 | |||||||||||||||||||||||||||||||||||
| 78 | ## | ||||||||||||||||||||||||||||||||||
| 79 | ## Private method that matches for opentagged. | ||||||||||||||||||||||||||||||||||
| 80 | ## | ||||||||||||||||||||||||||||||||||
| 81 | |||||||||||||||||||||||||||||||||||
| 82 | 0 | ▶ | sub _is_open_tagged { | ||||||||||||||||||||||||||||||||
|
Subroutine
_is_open_tagged: not called CC=5 SCAR=34.0
| |||||||||||||||||||||||||||||||||||
| 83 | 0 | my $self = shift; | |||||||||||||||||||||||||||||||||
| 84 | 0 | ▶ | my $arg = shift || $_; | ||||||||||||||||||||||||||||||||
|
Condition0%0/3
shift() || $_
MC/DC0%0/2
shift() || $_
shift()
$_
Truth table0%0/3
A || B
A= shift()B= $_
| |||||||||||||||||||||||||||||||||||
| 85 | 0 | ▶ | if ($arg =~ /<(([a-zA-Z])+((\s+\w+)=?("?\w+"?)?){0,})( (\/)?)?\s*>/) { | ||||||||||||||||||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||||||||||||||||||
| 86 | 0 | return 1; | |||||||||||||||||||||||||||||||||
| 87 | } else { | ||||||||||||||||||||||||||||||||||
| 88 | 0 | return 0; | |||||||||||||||||||||||||||||||||
| 89 | } | ||||||||||||||||||||||||||||||||||
| 90 | 0 | ▶ | $_ = $arg if ($arg); | ||||||||||||||||||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||||||||||||||||||
| 91 | 0 | ▶ | $self->{string} = $arg if ($arg); | ||||||||||||||||||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||||||||||||||||||
| 92 | } | ||||||||||||||||||||||||||||||||||
| 93 | |||||||||||||||||||||||||||||||||||
| 94 | ## | ||||||||||||||||||||||||||||||||||
| 95 | ## Private method that matches for closetagged. | ||||||||||||||||||||||||||||||||||
| 96 | ## | ||||||||||||||||||||||||||||||||||
| 97 | |||||||||||||||||||||||||||||||||||
| 98 | 0 | ▶ | sub _is_close_tagged { | ||||||||||||||||||||||||||||||||
|
Subroutine
_is_close_tagged: not called CC=5 SCAR=34.0
| |||||||||||||||||||||||||||||||||||
| 99 | 0 | my $self = shift; | |||||||||||||||||||||||||||||||||
| 100 | 0 | ▶ | my $arg = shift || $_; | ||||||||||||||||||||||||||||||||
|
Condition0%0/3
shift() || $_
MC/DC0%0/2
shift() || $_
shift()
$_
Truth table0%0/3
A || B
A= shift()B= $_
| |||||||||||||||||||||||||||||||||||
| 101 | 0 | ▶ | if ($arg =~ /<\/([a-zA-Z])+\s*>/) { | ||||||||||||||||||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||||||||||||||||||
| 102 | 0 | return 1; | |||||||||||||||||||||||||||||||||
| 103 | } else { | ||||||||||||||||||||||||||||||||||
| 104 | 0 | return 0; | |||||||||||||||||||||||||||||||||
| 105 | } | ||||||||||||||||||||||||||||||||||
| 106 | 0 | ▶ | $_ = $arg if ($arg); | ||||||||||||||||||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||||||||||||||||||
| 107 | 0 | ▶ | $self->{string} = $arg if ($arg); | ||||||||||||||||||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||||||||||||||||||
| 108 | } | ||||||||||||||||||||||||||||||||||
| 109 | |||||||||||||||||||||||||||||||||||
| 110 | ## | ||||||||||||||||||||||||||||||||||
| 111 | ## Private method that matches for empty. | ||||||||||||||||||||||||||||||||||
| 112 | ## | ||||||||||||||||||||||||||||||||||
| 113 | |||||||||||||||||||||||||||||||||||
| 114 | 0 | ▶ | sub _is_empty_element { | ||||||||||||||||||||||||||||||||
|
Subroutine
_is_empty_element: not called CC=5 SCAR=34.0
| |||||||||||||||||||||||||||||||||||
| 115 | 0 | my $self = shift; | |||||||||||||||||||||||||||||||||
| 116 | 0 | ▶ | my $arg = shift || $_; | ||||||||||||||||||||||||||||||||
|
Condition0%0/3
shift() || $_
MC/DC0%0/2
shift() || $_
shift()
$_
Truth table0%0/3
A || B
A= shift()B= $_
| |||||||||||||||||||||||||||||||||||
| 117 | 0 | ▶ | if ($arg =~ /<(([a-zA-Z])+((\s+\w+)=?("?.+"?)?){0,})(\s*\/)\s*>/) { | ||||||||||||||||||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||||||||||||||||||
| 118 | 0 | return 1; | |||||||||||||||||||||||||||||||||
| 119 | } else { | ||||||||||||||||||||||||||||||||||
| 120 | 0 | return 0; | |||||||||||||||||||||||||||||||||
| 121 | } | ||||||||||||||||||||||||||||||||||
| 122 | 0 | ▶ | $_ = $arg if ($arg); | ||||||||||||||||||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||||||||||||||||||
| 123 | 0 | ▶ | $self->{string} = $arg if ($arg); | ||||||||||||||||||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||||||||||||||||||
| 124 | } | ||||||||||||||||||||||||||||||||||
| 125 | |||||||||||||||||||||||||||||||||||
| 126 | ## | ||||||||||||||||||||||||||||||||||
| 127 | ## Private method for comment(). | ||||||||||||||||||||||||||||||||||
| 128 | ## | ||||||||||||||||||||||||||||||||||
| 129 | |||||||||||||||||||||||||||||||||||
| 130 | 0 | ▶ | sub _is_comment { | ||||||||||||||||||||||||||||||||
|
Subroutine
_is_comment: not called CC=7 SCAR=40.3
| |||||||||||||||||||||||||||||||||||
| 131 | 0 | my $self = shift; | |||||||||||||||||||||||||||||||||
| 132 | 0 | ▶ | my $arg = shift || $_; | ||||||||||||||||||||||||||||||||
|
Condition0%0/3
shift() || $_
MC/DC0%0/2
shift() || $_
shift()
$_
Truth table0%0/3
A || B
A= shift()B= $_
| |||||||||||||||||||||||||||||||||||
| 133 | |||||||||||||||||||||||||||||||||||
| 134 | 0 | ▶ | if ($Allow_Hyphen) { | ||||||||||||||||||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||||||||||||||||||
| 135 | 0 | ▶ | if ($arg =~ /<!--.*-->/) { | ||||||||||||||||||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||||||||||||||||||
| 136 | 0 | return 1; | |||||||||||||||||||||||||||||||||
| 137 | } else { | ||||||||||||||||||||||||||||||||||
| 138 | 0 | return 0; | |||||||||||||||||||||||||||||||||
| 139 | } | ||||||||||||||||||||||||||||||||||
| 140 | } else { | ||||||||||||||||||||||||||||||||||
| 141 | 0 | ▶ | if ($arg =~ /<!--[^\-]-->/) { | ||||||||||||||||||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||||||||||||||||||
| 142 | 0 | return 1; | |||||||||||||||||||||||||||||||||
| 143 | } else { | ||||||||||||||||||||||||||||||||||
| 144 | 0 | return 0; | |||||||||||||||||||||||||||||||||
| 145 | } | ||||||||||||||||||||||||||||||||||
| 146 | } | ||||||||||||||||||||||||||||||||||
| 147 | 0 | ▶ | $_ = $arg if ($arg); | ||||||||||||||||||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||||||||||||||||||
| 148 | 0 | ▶ | $self->{string} = $arg if ($arg); | ||||||||||||||||||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||||||||||||||||||
| 149 | } | ||||||||||||||||||||||||||||||||||
| 150 | |||||||||||||||||||||||||||||||||||
| 151 | #################################### | ||||||||||||||||||||||||||||||||||
| 152 | ##########PUBLIC METHODS############ | ||||||||||||||||||||||||||||||||||
| 153 | #################################### | ||||||||||||||||||||||||||||||||||
| 154 | |||||||||||||||||||||||||||||||||||
| 155 | ## | ||||||||||||||||||||||||||||||||||
| 156 | ## Get/set methods. | ||||||||||||||||||||||||||||||||||
| 157 | ## one for getting/setting the string(currenly does not work), and one for | ||||||||||||||||||||||||||||||||||
| 158 | ## gettin/setting whether to allow hyphens in comments. | ||||||||||||||||||||||||||||||||||
| 159 | ## | ||||||||||||||||||||||||||||||||||
| 160 | |||||||||||||||||||||||||||||||||||
| 161 | 0 | ▶ | sub string { | ||||||||||||||||||||||||||||||||
|
Subroutine
string: not called CC=3 SCAR=24.8
Pod
undocumented
| |||||||||||||||||||||||||||||||||||
| 162 | 0 | my $self = shift; | |||||||||||||||||||||||||||||||||
| 163 | 0 | my $string = $self->{string}; | |||||||||||||||||||||||||||||||||
| 164 | 0 | ▶ | $string = shift unless ($self->{string}); | ||||||||||||||||||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||||||||||||||||||
| 165 | 0 | ▶ | return $self->{string} unless ($string); | ||||||||||||||||||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||||||||||||||||||
| 166 | } | ||||||||||||||||||||||||||||||||||
| 167 | |||||||||||||||||||||||||||||||||||
| 168 | 0 | ▶ | sub allow_hyphen { | ||||||||||||||||||||||||||||||||
|
Subroutine
allow_hyphen: not called CC=2 SCAR=17.9
Pod
undocumented
| |||||||||||||||||||||||||||||||||||
| 169 | 0 | my $self = shift; | |||||||||||||||||||||||||||||||||
| 170 | 0 | my $arg = shift; | |||||||||||||||||||||||||||||||||
| 171 | 0 | $Allow_Hyphen = $arg; | |||||||||||||||||||||||||||||||||
| 172 | 0 | ▶ | return $Allow_Hyphen unless ($arg); | ||||||||||||||||||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||||||||||||||||||
| 173 | } | ||||||||||||||||||||||||||||||||||
| 174 | |||||||||||||||||||||||||||||||||||
| 175 | 0 | ▶ | sub tagged { | ||||||||||||||||||||||||||||||||
|
Subroutine
tagged: not called CC=6 SCAR=37.4
Pod
documented
| |||||||||||||||||||||||||||||||||||
| 176 | 0 | my $self = shift; | |||||||||||||||||||||||||||||||||
| 177 | 0 | ▶ | my $string = shift || $self->{string} || $_; #string to look at. | ||||||||||||||||||||||||||||||||
|
Condition0%0/6
shift() || $self->{'string'} || $_
shift() or $self->{"string"}
MC/DC0%0/3
shift() || $self->{'string'} || $_
shift()
$self->{"string"}
$_
Truth table0%0/4
A or B || C
A= shift()B= $self->{"string"}C= $_
| |||||||||||||||||||||||||||||||||||
| 178 | ##check to see if it has both a start tag and an end tag. | ||||||||||||||||||||||||||||||||||
| 179 | 0 | ▶ | if (_is_fully_tagged ($self->{string})) { | ||||||||||||||||||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||||||||||||||||||
| 180 | ##set some variables just in case. | ||||||||||||||||||||||||||||||||||
| 181 | 0 | my $tag = $1; | |||||||||||||||||||||||||||||||||
| 182 | 0 | my $element = $2; | |||||||||||||||||||||||||||||||||
| 183 | 0 | my $fullattr = $3; | |||||||||||||||||||||||||||||||||
| 184 | 0 | my $attrname = $4; | |||||||||||||||||||||||||||||||||
| 185 | 0 | my $attrvalue = $5; | |||||||||||||||||||||||||||||||||
| 186 | 0 | return 1; | |||||||||||||||||||||||||||||||||
| 187 | } else { | ||||||||||||||||||||||||||||||||||
| 188 | 0 | return 0; | |||||||||||||||||||||||||||||||||
| 189 | } | ||||||||||||||||||||||||||||||||||
| 190 | 0 | ▶ | $self->{string} = $string if ($string); | ||||||||||||||||||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||||||||||||||||||
| 191 | 0 | ▶ | $_ = $self->{string} if ($self->{string}); | ||||||||||||||||||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||||||||||||||||||
| 192 | } | ||||||||||||||||||||||||||||||||||
| 193 | |||||||||||||||||||||||||||||||||||
| 194 | 0 | ▶ | sub opentagged { | ||||||||||||||||||||||||||||||||
|
Subroutine
opentagged: not called CC=6 SCAR=37.4
Pod
documented
| |||||||||||||||||||||||||||||||||||
| 195 | 0 | my $self = shift; | |||||||||||||||||||||||||||||||||
| 196 | 0 | ▶ | my $string = shift || $self->{string} || $_; #string to look at. | ||||||||||||||||||||||||||||||||
|
Condition0%0/6
shift() || $self->{'string'} || $_
shift() or $self->{"string"}
MC/DC0%0/3
shift() || $self->{'string'} || $_
shift()
$self->{"string"}
$_
Truth table0%0/4
A or B || C
A= shift()B= $self->{"string"}C= $_
| |||||||||||||||||||||||||||||||||||
| 197 | ##check to see if it at least has a start tag. | ||||||||||||||||||||||||||||||||||
| 198 | 0 | ▶ | if (_is_open_tagged ($string)) { | ||||||||||||||||||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||||||||||||||||||
| 199 | ##regexp vars. | ||||||||||||||||||||||||||||||||||
| 200 | 0 | my $tag = $1; | |||||||||||||||||||||||||||||||||
| 201 | 0 | my $element = $2; | |||||||||||||||||||||||||||||||||
| 202 | 0 | my $fullattr = $3; | |||||||||||||||||||||||||||||||||
| 203 | 0 | my $attrname = $4; | |||||||||||||||||||||||||||||||||
| 204 | 0 | my $attrvalue = $5; | |||||||||||||||||||||||||||||||||
| 205 | 0 | return 1; | |||||||||||||||||||||||||||||||||
| 206 | } else { | ||||||||||||||||||||||||||||||||||
| 207 | 0 | return 0; | |||||||||||||||||||||||||||||||||
| 208 | } | ||||||||||||||||||||||||||||||||||
| 209 | 0 | ▶ | $self->{string} = $string if ($string); | ||||||||||||||||||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||||||||||||||||||
| 210 | 0 | ▶ | $_ = $self->{string} if ($self->{string}); | ||||||||||||||||||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||||||||||||||||||
| 211 | } | ||||||||||||||||||||||||||||||||||
| 212 | |||||||||||||||||||||||||||||||||||
| 213 | 0 | ▶ | sub closetagged { | ||||||||||||||||||||||||||||||||
|
Subroutine
closetagged: not called CC=6 SCAR=37.4
Pod
documented
| |||||||||||||||||||||||||||||||||||
| 214 | 0 | my $self = shift; | |||||||||||||||||||||||||||||||||
| 215 | 0 | ▶ | my $string = shift || $self->{string} || $_; #string to look at. | ||||||||||||||||||||||||||||||||
|
Condition0%0/6
shift() || $self->{'string'} || $_
shift() or $self->{"string"}
MC/DC0%0/3
shift() || $self->{'string'} || $_
shift()
$self->{"string"}
$_
Truth table0%0/4
A or B || C
A= shift()B= $self->{"string"}C= $_
| |||||||||||||||||||||||||||||||||||
| 216 | ##check to see if it at least has an end tag. | ||||||||||||||||||||||||||||||||||
| 217 | 0 | ▶ | if (_is_close_tagged ($string)) { | ||||||||||||||||||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||||||||||||||||||
| 218 | ##regexp vars. | ||||||||||||||||||||||||||||||||||
| 219 | 0 | my $tag = $1; | |||||||||||||||||||||||||||||||||
| 220 | 0 | my $element = $2; | |||||||||||||||||||||||||||||||||
| 221 | 0 | my $fullattr = $3; | |||||||||||||||||||||||||||||||||
| 222 | 0 | my $attrname = $4; | |||||||||||||||||||||||||||||||||
| 223 | 0 | my $attrvalue = $5; | |||||||||||||||||||||||||||||||||
| 224 | 0 | return 1; | |||||||||||||||||||||||||||||||||
| 225 | } else { | ||||||||||||||||||||||||||||||||||
| 226 | 0 | return 0; | |||||||||||||||||||||||||||||||||
| 227 | } | ||||||||||||||||||||||||||||||||||
| 228 | 0 | ▶ | $self->{string} = $string if ($string); | ||||||||||||||||||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||||||||||||||||||
| 229 | 0 | ▶ | $_ = $self->{string} if ($self->{string}); | ||||||||||||||||||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||||||||||||||||||
| 230 | } | ||||||||||||||||||||||||||||||||||
| 231 | |||||||||||||||||||||||||||||||||||
| 232 | 0 | ▶ | sub tagpos { | ||||||||||||||||||||||||||||||||
|
Subroutine
tagpos: not called CC=11 SCAR=48.8
Pod
documented
| |||||||||||||||||||||||||||||||||||
| 233 | 0 | my $self = shift; | |||||||||||||||||||||||||||||||||
| 234 | 0 | ▶ | my $string = shift || $self->{string} || $_; #string to look at. | ||||||||||||||||||||||||||||||||
|
Condition0%0/6
shift() || $self->{'string'} || $_
shift() or $self->{"string"}
MC/DC0%0/3
shift() || $self->{'string'} || $_
shift()
$self->{"string"}
$_
Truth table0%0/4
A or B || C
A= shift()B= $self->{"string"}C= $_
| |||||||||||||||||||||||||||||||||||
| 235 | 0 | ▶ | my $tag = shift || $self->{tag} || $_; #tag to look for. | ||||||||||||||||||||||||||||||||
|
Condition0%0/6
shift() || $self->{'tag'} || $_
shift() or $self->{"tag"}
MC/DC0%0/3
shift() || $self->{'tag'} || $_
shift()
$self->{"tag"}
$_
Truth table0%0/4
A or B || C
A= shift()B= $self->{"tag"}C= $_
| |||||||||||||||||||||||||||||||||||
| 236 | 0 | ▶ | my $offset = shift || 0; # offset. | ||||||||||||||||||||||||||||||||
|
Condition0%0/2
shift() || 0
MC/DC0%0/1
shift() || 0
shift()
Truth table0%0/2
A
A= shift()
| |||||||||||||||||||||||||||||||||||
| 237 | 0 | ▶ | $tag = '<' . $tag . '>' if ($tag !~ /(<(([a-zA-Z])+((\s+\w+)=?("?\w+"?)?){0,})( (\/)?)?\s*>|<\/([a-zA-Z])+\s*>)/); | ||||||||||||||||||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||||||||||||||||||
| 238 | 0 | return index ($string, $tag, $offset) + 1; | |||||||||||||||||||||||||||||||||
| 239 | 0 | ▶ | $self->{string} = $string if ($string); | ||||||||||||||||||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||||||||||||||||||
| 240 | 0 | ▶ | $self->{tag } = $tag if ($tag); | ||||||||||||||||||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||||||||||||||||||
| 241 | 0 | ▶ | $_ = $self->{string} if ($self->{string}); | ||||||||||||||||||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||||||||||||||||||
| 242 | 0 | ▶ | $_ .= "||$tag" if ($self->{tag}); | ||||||||||||||||||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||||||||||||||||||
| 243 | } | ||||||||||||||||||||||||||||||||||
| 244 | |||||||||||||||||||||||||||||||||||
| 245 | 0 | ▶ | sub empty { | ||||||||||||||||||||||||||||||||
|
Subroutine
empty: not called CC=6 SCAR=37.4
Pod
documented
| |||||||||||||||||||||||||||||||||||
| 246 | 0 | my $self = shift; | |||||||||||||||||||||||||||||||||
| 247 | 0 | ▶ | my $string = shift || $self->{string} || $_; | ||||||||||||||||||||||||||||||||
|
Condition0%0/6
shift() || $self->{'string'} || $_
shift() or $self->{"string"}
MC/DC0%0/3
shift() || $self->{'string'} || $_
shift()
$self->{"string"}
$_
Truth table0%0/4
A or B || C
A= shift()B= $self->{"string"}C= $_
| |||||||||||||||||||||||||||||||||||
| 248 | 0 | ▶ | if (_is_empty_element ($string)) { | ||||||||||||||||||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||||||||||||||||||
| 249 | 0 | return 1; | |||||||||||||||||||||||||||||||||
| 250 | 0 | my $tag = $1; | |||||||||||||||||||||||||||||||||
| 251 | 0 | my $element = $2; | |||||||||||||||||||||||||||||||||
| 252 | 0 | my $fullattr = $3; | |||||||||||||||||||||||||||||||||
| 253 | 0 | my $attrname = $4; | |||||||||||||||||||||||||||||||||
| 254 | 0 | my $attrvalue = $5; | |||||||||||||||||||||||||||||||||
| 255 | } else { | ||||||||||||||||||||||||||||||||||
| 256 | 0 | return 0; | |||||||||||||||||||||||||||||||||
| 257 | } | ||||||||||||||||||||||||||||||||||
| 258 | 0 | ▶ | $self->{string} = $string if ($string); | ||||||||||||||||||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||||||||||||||||||
| 259 | 0 | ▶ | $_ = $self->{string} if ($self->{string}); | ||||||||||||||||||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||||||||||||||||||
| 260 | } | ||||||||||||||||||||||||||||||||||
| 261 | |||||||||||||||||||||||||||||||||||
| 262 | 0 | ▶ | sub comment { | ||||||||||||||||||||||||||||||||
|
Subroutine
comment: not called CC=6 SCAR=37.4
Pod
documented
| |||||||||||||||||||||||||||||||||||
| 263 | 0 | my $self = shift; | |||||||||||||||||||||||||||||||||
| 264 | 0 | ▶ | my $string = shift || $self->{string} || $_; | ||||||||||||||||||||||||||||||||
|
Condition0%0/6
shift() || $self->{'string'} || $_
shift() or $self->{"string"}
MC/DC0%0/3
shift() || $self->{'string'} || $_
shift()
$self->{"string"}
$_
Truth table0%0/4
A or B || C
A= shift()B= $self->{"string"}C= $_
| |||||||||||||||||||||||||||||||||||
| 265 | 0 | ▶ | if (_is_comment($string)) { | ||||||||||||||||||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||||||||||||||||||
| 266 | 0 | my $tag = $1; | |||||||||||||||||||||||||||||||||
| 267 | 0 | my $element = $2; | |||||||||||||||||||||||||||||||||
| 268 | 0 | my $fullattr = $3; | |||||||||||||||||||||||||||||||||
| 269 | 0 | my $attrname = $4; | |||||||||||||||||||||||||||||||||
| 270 | 0 | my $attrvalue = $5; | |||||||||||||||||||||||||||||||||
| 271 | 0 | return 1; | |||||||||||||||||||||||||||||||||
| 272 | } else { | ||||||||||||||||||||||||||||||||||
| 273 | 0 | return 0; | |||||||||||||||||||||||||||||||||
| 274 | } | ||||||||||||||||||||||||||||||||||
| 275 | 0 | ▶ | $self->{string} = $string if ($string); | ||||||||||||||||||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||||||||||||||||||
| 276 | 0 | ▶ | $_ = $self->{string} if ($self->{string}); | ||||||||||||||||||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||||||||||||||||||
| 277 | } | ||||||||||||||||||||||||||||||||||
| 278 | |||||||||||||||||||||||||||||||||||
| 279 | |||||||||||||||||||||||||||||||||||
| 280 | |||||||||||||||||||||||||||||||||||
| 281 | 1 | 1; | |||||||||||||||||||||||||||||||||
| 282 | |||||||||||||||||||||||||||||||||||
| 283 | __END__ | ||||||||||||||||||||||||||||||||||