line |
stmt |
bran |
cond |
sub |
pod |
time |
code |
1
|
|
|
|
|
|
|
package HTML::Lint::Pluggable; |
2
|
3
|
|
|
3
|
|
180494
|
use strict; |
|
3
|
|
|
|
|
27
|
|
|
3
|
|
|
|
|
76
|
|
3
|
3
|
|
|
3
|
|
12
|
use warnings; |
|
3
|
|
|
|
|
4
|
|
|
3
|
|
|
|
|
106
|
|
4
|
|
|
|
|
|
|
|
5
|
|
|
|
|
|
|
our $VERSION = '0.09'; |
6
|
|
|
|
|
|
|
|
7
|
3
|
|
|
3
|
|
1177
|
use parent qw/ HTML::Lint /; |
|
3
|
|
|
|
|
810
|
|
|
3
|
|
|
|
|
14
|
|
8
|
|
|
|
|
|
|
|
9
|
3
|
|
|
3
|
|
50875
|
use Carp qw/croak/; |
|
3
|
|
|
|
|
6
|
|
|
3
|
|
|
|
|
230
|
|
10
|
3
|
|
|
3
|
|
1308
|
use Module::Load (); |
|
3
|
|
|
|
|
2927
|
|
|
3
|
|
|
|
|
56
|
|
11
|
3
|
|
|
3
|
|
1281
|
use Package::Stash; |
|
3
|
|
|
|
|
23212
|
|
|
3
|
|
|
|
|
677
|
|
12
|
|
|
|
|
|
|
|
13
|
|
|
|
|
|
|
sub new { |
14
|
14
|
|
|
14
|
1
|
51996
|
my $class = shift; |
15
|
|
|
|
|
|
|
|
16
|
14
|
|
|
|
|
23
|
my $subclass; |
17
|
14
|
|
|
|
|
19
|
do { |
18
|
14
|
|
|
|
|
240
|
$subclass = sprintf '%s::__ANON__::%x%x%x', $class, $$, 0+{}, int(rand(65535)); |
19
|
|
|
|
|
|
|
} while $subclass->isa($class); |
20
|
|
|
|
|
|
|
|
21
|
14
|
|
|
|
|
24
|
push @{ Package::Stash->new($subclass)->get_or_add_symbol('@ISA') } => $class; |
|
14
|
|
|
|
|
439
|
|
22
|
|
|
|
|
|
|
|
23
|
14
|
|
|
|
|
59
|
return $subclass->SUPER::new(@_); |
24
|
|
|
|
|
|
|
} |
25
|
|
|
|
|
|
|
|
26
|
|
|
|
|
|
|
sub load_plugins { |
27
|
7
|
|
|
7
|
1
|
121
|
my $self = shift; |
28
|
7
|
|
|
|
|
19
|
while (@_) { |
29
|
10
|
|
|
|
|
14
|
my $plugin = shift; |
30
|
10
|
50
|
66
|
|
|
54
|
my $conf = @_ > 0 && ref($_[0]) eq 'HASH' ? +shift : undef; |
31
|
10
|
|
|
|
|
46
|
$self->load_plugin($plugin, $conf); |
32
|
|
|
|
|
|
|
} |
33
|
|
|
|
|
|
|
} |
34
|
|
|
|
|
|
|
|
35
|
|
|
|
|
|
|
sub load_plugin { |
36
|
10
|
|
|
10
|
1
|
23
|
my ($self, $plugin, $conf) = @_; |
37
|
10
|
50
|
|
|
|
35
|
$plugin = "HTML::Lint::Pluggable::${plugin}" unless $plugin =~ s/^\+//; |
38
|
10
|
|
|
|
|
50
|
Module::Load::load($plugin); |
39
|
10
|
|
|
|
|
419
|
$plugin->init($self, $conf); |
40
|
|
|
|
|
|
|
} |
41
|
|
|
|
|
|
|
|
42
|
|
|
|
|
|
|
sub override { |
43
|
10
|
|
|
10
|
0
|
63
|
my ($self, $method, $code) = @_; |
44
|
10
|
50
|
|
|
|
24
|
my $class = ref($self) or croak('this method can called by instance only.'); |
45
|
|
|
|
|
|
|
|
46
|
10
|
|
|
|
|
75
|
my $override_code = $code->($class->can($method)); |
47
|
|
|
|
|
|
|
|
48
|
|
|
|
|
|
|
{ |
49
|
3
|
|
|
3
|
|
22
|
no strict 'refs'; ## no critic |
|
3
|
|
|
|
|
13
|
|
|
3
|
|
|
|
|
78
|
|
|
10
|
|
|
|
|
14
|
|
50
|
3
|
|
|
3
|
|
15
|
no warnings 'redefine'; |
|
3
|
|
|
|
|
3
|
|
|
3
|
|
|
|
|
217
|
|
51
|
10
|
|
|
|
|
12
|
*{"${class}::${method}"} = $override_code; |
|
10
|
|
|
|
|
79
|
|
52
|
|
|
|
|
|
|
} |
53
|
|
|
|
|
|
|
} |
54
|
|
|
|
|
|
|
|
55
|
|
|
|
|
|
|
1; |
56
|
|
|
|
|
|
|
__END__ |