line |
stmt |
bran |
cond |
sub |
pod |
time |
code |
1
|
|
|
|
|
|
|
|
2
|
|
|
|
|
|
|
package HTML::Transmorgify::Crumbs; |
3
|
|
|
|
|
|
|
|
4
|
1
|
|
|
1
|
|
948
|
use strict; |
|
1
|
|
|
|
|
3
|
|
|
1
|
|
|
|
|
46
|
|
5
|
1
|
|
|
1
|
|
4
|
use warnings; |
|
1
|
|
|
|
|
3
|
|
|
1
|
|
|
|
|
38
|
|
6
|
1
|
|
|
1
|
|
4
|
use Digest::MD5 qw(md5_hex); |
|
1
|
|
|
|
|
3
|
|
|
1
|
|
|
|
|
66
|
|
7
|
1
|
|
|
1
|
|
5
|
use HTML::Transmorgify qw(rbuf $result queue_intercept); |
|
1
|
|
|
|
|
2
|
|
|
1
|
|
|
|
|
921
|
|
8
|
|
|
|
|
|
|
|
9
|
|
|
|
|
|
|
our @ISA = qw(HTML::Transmorgify); |
10
|
|
|
|
|
|
|
|
11
|
|
|
|
|
|
|
our $sign; |
12
|
|
|
|
|
|
|
|
13
|
|
|
|
|
|
|
my %tags; |
14
|
|
|
|
|
|
|
|
15
|
|
|
|
|
|
|
sub add_tags |
16
|
|
|
|
|
|
|
{ |
17
|
1
|
|
|
1
|
0
|
3
|
my ($self, $tobj) = @_; |
18
|
1
|
|
|
|
|
46
|
$self->intercept_shared($tobj, __PACKAGE__, 85, %tags); |
19
|
|
|
|
|
|
|
} |
20
|
|
|
|
|
|
|
|
21
|
|
|
|
|
|
|
sub reform |
22
|
|
|
|
|
|
|
{ |
23
|
2
|
|
|
2
|
0
|
5
|
my ($href, $sig) = @_; |
24
|
2
|
50
|
|
|
|
6
|
if ($href =~ /\?/) { |
25
|
0
|
|
|
|
|
0
|
return "$href&%20crumb=$sig"; |
26
|
|
|
|
|
|
|
} else { |
27
|
2
|
|
|
|
|
12
|
return "$href?%20crumb=$sig"; |
28
|
|
|
|
|
|
|
} |
29
|
|
|
|
|
|
|
} |
30
|
|
|
|
|
|
|
|
31
|
|
|
|
|
|
|
sub regular_tag |
32
|
|
|
|
|
|
|
{ |
33
|
3
|
|
|
3
|
0
|
6
|
my ($attribute, $attr, $closed) = @_; |
34
|
|
|
|
|
|
|
# |
35
|
|
|
|
|
|
|
# The point of compiling is to be able to use things |
36
|
|
|
|
|
|
|
# more than once. Let's copy the href and then use |
37
|
|
|
|
|
|
|
# the copy on subsequent executions. |
38
|
|
|
|
|
|
|
# |
39
|
3
|
|
|
|
|
12
|
$attr->set(" $attribute" => $attr->raw($attribute)); |
40
|
3
|
|
|
|
|
15
|
$attr->hide(" $attribute"); |
41
|
3
|
|
|
|
|
15
|
$attr->eval_at_runtime(1); |
42
|
|
|
|
|
|
|
rbuf(sub { |
43
|
3
|
50
|
|
3
|
|
17
|
return 1 unless $sign; |
44
|
3
|
|
|
|
|
22
|
my $href = $attr->get(" $attribute"); |
45
|
3
|
|
|
|
|
11
|
my $sig = $sign->($href); |
46
|
3
|
100
|
|
|
|
41
|
$attr->set($attribute => reform($href, $sig)) |
47
|
|
|
|
|
|
|
if $sig; |
48
|
3
|
|
|
|
|
7
|
return 1; |
49
|
3
|
|
|
|
|
18
|
}); |
50
|
3
|
|
|
|
|
10
|
return 1; |
51
|
|
|
|
|
|
|
} |
52
|
|
|
|
|
|
|
|
53
|
|
|
|
|
|
|
$tags{a} = \&a_tag; |
54
|
|
|
|
|
|
|
$tags{img} = \&img_tag; |
55
|
|
|
|
|
|
|
$tags{frame} = \&frame_tag; |
56
|
|
|
|
|
|
|
$tags{form} = \&form_tag; |
57
|
|
|
|
|
|
|
$tags{"/form"} = sub { 1 }; |
58
|
|
|
|
|
|
|
|
59
|
|
|
|
|
|
|
sub a_tag |
60
|
|
|
|
|
|
|
{ |
61
|
2
|
|
|
2
|
0
|
7
|
regular_tag('href', @_); |
62
|
|
|
|
|
|
|
} |
63
|
|
|
|
|
|
|
|
64
|
|
|
|
|
|
|
sub img_tag |
65
|
|
|
|
|
|
|
{ |
66
|
1
|
|
|
1
|
0
|
4
|
regular_tag('src', @_); |
67
|
|
|
|
|
|
|
} |
68
|
|
|
|
|
|
|
|
69
|
|
|
|
|
|
|
sub frame_tag |
70
|
|
|
|
|
|
|
{ |
71
|
0
|
|
|
0
|
0
|
0
|
regular_tag('src', @_); |
72
|
|
|
|
|
|
|
} |
73
|
|
|
|
|
|
|
|
74
|
|
|
|
|
|
|
sub script_tag |
75
|
0
|
|
|
0
|
0
|
0
|
{ |
76
|
|
|
|
|
|
|
# XXX |
77
|
|
|
|
|
|
|
} |
78
|
|
|
|
|
|
|
|
79
|
|
|
|
|
|
|
sub form_tag |
80
|
|
|
|
|
|
|
{ |
81
|
1
|
|
|
1
|
0
|
3
|
my ($attr, $closed) = @_; |
82
|
|
|
|
|
|
|
|
83
|
1
|
|
|
|
|
2
|
my $end_form; |
84
|
|
|
|
|
|
|
|
85
|
|
|
|
|
|
|
# called at |
86
|
|
|
|
|
|
|
rbuf(sub { |
87
|
1
|
|
|
1
|
|
2
|
$end_form = ''; |
88
|
1
|
50
|
|
|
|
5
|
return 1 unless $sign; |
89
|
1
|
|
|
|
|
4
|
my $action = $attr->get('action'); |
90
|
1
|
|
|
|
|
4
|
my $sig = $sign->($action); |
91
|
1
|
50
|
|
|
|
14
|
if ($sig) { |
92
|
1
|
|
|
|
|
6
|
$end_form = ""; |
93
|
|
|
|
|
|
|
} |
94
|
1
|
|
|
|
|
9
|
}); |
95
|
|
|
|
|
|
|
|
96
|
|
|
|
|
|
|
my $close_cb = sub { |
97
|
|
|
|
|
|
|
rbuf(sub { |
98
|
1
|
|
|
|
|
3
|
$HTML::Transmorgify::result->[0] .= $end_form; |
99
|
1
|
|
|
1
|
|
7
|
}); |
100
|
1
|
|
|
|
|
4
|
}; |
101
|
1
|
|
|
|
|
5
|
queue_intercept(__PACKAGE__, |
102
|
|
|
|
|
|
|
"/form" => $close_cb, |
103
|
|
|
|
|
|
|
); |
104
|
1
|
|
|
|
|
3
|
1; |
105
|
|
|
|
|
|
|
} |
106
|
|
|
|
|
|
|
|
107
|
|
|
|
|
|
|
1; |