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