line |
stmt |
bran |
cond |
sub |
pod |
time |
code |
1
|
|
|
|
|
|
|
package HTML::WidgetValidator::HTMLElement;
|
2
|
45
|
|
|
45
|
|
260
|
use warnings;
|
|
45
|
|
|
|
|
83
|
|
|
45
|
|
|
|
|
1722
|
|
3
|
45
|
|
|
45
|
|
227
|
use strict;
|
|
45
|
|
|
|
|
84
|
|
|
45
|
|
|
|
|
1629
|
|
4
|
45
|
|
|
45
|
|
224
|
use base qw(Class::Accessor::Fast);
|
|
45
|
|
|
|
|
72
|
|
|
45
|
|
|
|
|
1439
|
|
5
|
|
|
|
|
|
|
|
6
|
|
|
|
|
|
|
__PACKAGE__->mk_accessors(qw(type name attr text));
|
7
|
|
|
|
|
|
|
|
8
|
|
|
|
|
|
|
sub new {
|
9
|
0
|
|
|
0
|
1
|
|
my ($class, %args) = @_;
|
10
|
0
|
|
|
|
|
|
my $self = $class->SUPER::new(\%args);
|
11
|
0
|
|
|
|
|
|
return $self;
|
12
|
|
|
|
|
|
|
}
|
13
|
|
|
|
|
|
|
|
14
|
|
|
|
|
|
|
sub compare {
|
15
|
0
|
|
|
0
|
0
|
|
my ($self, $model ) = @_;
|
16
|
|
|
|
|
|
|
|
17
|
0
|
0
|
|
|
|
|
return unless $model;
|
18
|
0
|
0
|
|
|
|
|
return unless $self->{type} eq $model->{type};
|
19
|
0
|
0
|
0
|
|
|
|
return if( $self->name && lc($self->name) ne $model->{name} );
|
20
|
|
|
|
|
|
|
|
21
|
0
|
0
|
|
|
|
|
if( $model->{text} ){
|
22
|
0
|
0
|
|
|
|
|
return unless _compare( $self->text, $model->{text} );
|
23
|
|
|
|
|
|
|
}
|
24
|
0
|
0
|
0
|
|
|
|
if( $self->attr && scalar keys %{$self->attr} > 0 ){
|
|
0
|
0
|
|
|
|
|
|
25
|
0
|
0
|
|
|
|
|
return unless $model->{attr};
|
26
|
0
|
0
|
|
|
|
|
return if scalar keys %{$self->attr} != scalar keys %{$model->{attr}};
|
|
0
|
|
|
|
|
|
|
|
0
|
|
|
|
|
|
|
27
|
0
|
|
|
|
|
|
foreach my $attr ( keys %{$self->attr} ){
|
|
0
|
|
|
|
|
|
|
28
|
0
|
0
|
|
|
|
|
return unless defined $model->{attr}->{$attr};
|
29
|
0
|
0
|
|
|
|
|
return unless _compare( $self->attr->{$attr}, $model->{attr}->{$attr} );
|
30
|
|
|
|
|
|
|
}
|
31
|
|
|
|
|
|
|
}elsif( $model->{attr} ){
|
32
|
0
|
|
|
|
|
|
return;
|
33
|
|
|
|
|
|
|
}
|
34
|
0
|
|
|
|
|
|
return 1;
|
35
|
|
|
|
|
|
|
}
|
36
|
|
|
|
|
|
|
|
37
|
|
|
|
|
|
|
sub _compare {
|
38
|
0
|
|
|
0
|
|
|
my ( $text, $model ) = @_;
|
39
|
0
|
0
|
|
|
|
|
if( ref $model eq 'Regexp' ){
|
|
|
0
|
|
|
|
|
|
40
|
0
|
0
|
|
|
|
|
return $text =~ /^(?:$model)$/is ? 1 : 0;
|
41
|
|
|
|
|
|
|
}elsif( defined $model ){
|
42
|
0
|
0
|
|
|
|
|
return lc($text) eq lc($model) ? 1 : 0;
|
43
|
|
|
|
|
|
|
}
|
44
|
0
|
|
|
|
|
|
return 0;
|
45
|
|
|
|
|
|
|
}
|
46
|
|
|
|
|
|
|
|
47
|
|
|
|
|
|
|
1;
|
48
|
|
|
|
|
|
|
__END__
|