line |
stmt |
bran |
cond |
sub |
pod |
time |
code |
1
|
|
|
|
|
|
|
package HTML::StickyQuery::DoCoMoGUID; |
2
|
|
|
|
|
|
|
|
3
|
10
|
|
|
10
|
|
7525
|
use strict; |
|
10
|
|
|
|
|
19
|
|
|
10
|
|
|
|
|
295
|
|
4
|
10
|
|
|
10
|
|
48
|
use warnings; |
|
10
|
|
|
|
|
14
|
|
|
10
|
|
|
|
|
364
|
|
5
|
|
|
|
|
|
|
our $VERSION = '0.03'; |
6
|
|
|
|
|
|
|
|
7
|
10
|
|
|
10
|
|
9537
|
use HTML::StickyQuery; |
|
10
|
|
|
|
|
407399
|
|
|
10
|
|
|
|
|
7997
|
|
8
|
|
|
|
|
|
|
|
9
|
|
|
|
|
|
|
sub new { |
10
|
45
|
|
|
45
|
0
|
417
|
my ($class, %args) = @_; |
11
|
45
|
|
|
|
|
422
|
bless { |
12
|
|
|
|
|
|
|
sticky => HTML::StickyQuery->new( regexp => qr/./, %args ), |
13
|
|
|
|
|
|
|
}, $class; |
14
|
|
|
|
|
|
|
} |
15
|
|
|
|
|
|
|
|
16
|
|
|
|
|
|
|
sub sticky { |
17
|
45
|
|
|
45
|
0
|
4364
|
my($self, %args) = @_; |
18
|
45
|
|
100
|
|
|
247
|
$args{param} ||= {}; |
19
|
45
|
100
|
|
|
|
225
|
$args{param}->{guid} = 'ON' unless $args{disable_guid}; |
20
|
|
|
|
|
|
|
|
21
|
45
|
100
|
|
|
|
359
|
local $self->{sticky}->{use_xhtml} = exists $args{xhtml} ? $args{xhtml} : 1; |
22
|
|
|
|
|
|
|
|
23
|
45
|
|
|
|
|
156
|
local *_start = *HTML::StickyQuery::start; |
24
|
45
|
|
|
|
|
102
|
local *HTML::StickyQuery::start = *start; |
25
|
45
|
|
|
|
|
314
|
$self->{sticky}->sticky( %args ); |
26
|
|
|
|
|
|
|
} |
27
|
|
|
|
|
|
|
|
28
|
|
|
|
|
|
|
# sticky for FORM tag. original code is HTML::StickyQuery |
29
|
|
|
|
|
|
|
sub start { |
30
|
88
|
|
|
88
|
0
|
6583
|
my($self, $tagname, $attr, $attrseq, $orig) = @_; |
31
|
|
|
|
|
|
|
|
32
|
88
|
100
|
|
|
|
245
|
if ($tagname ne 'form') { |
33
|
|
|
|
|
|
|
# goto original code |
34
|
53
|
|
|
|
|
249
|
goto &_start; |
35
|
|
|
|
|
|
|
} |
36
|
|
|
|
|
|
|
|
37
|
35
|
50
|
|
|
|
102
|
unless(exists $attr->{action}) { |
38
|
0
|
|
|
|
|
0
|
$self->{output} .= $orig; |
39
|
0
|
|
|
|
|
0
|
return; |
40
|
|
|
|
|
|
|
} |
41
|
35
|
|
|
|
|
183
|
my $u = URI->new($attr->{action}); |
42
|
|
|
|
|
|
|
|
43
|
|
|
|
|
|
|
# skip absolute URI |
44
|
35
|
100
|
100
|
|
|
32814
|
if (!$self->{abs} && $u->scheme) { |
45
|
6
|
|
|
|
|
491
|
$self->{output} .= $orig; |
46
|
6
|
|
|
|
|
105
|
return; |
47
|
|
|
|
|
|
|
} |
48
|
|
|
|
|
|
|
|
49
|
|
|
|
|
|
|
# when URI has other scheme (ie. mailto ftp ..) |
50
|
29
|
50
|
66
|
|
|
824
|
if(defined($u->scheme) && $u->scheme !~ m/^https?/) { |
51
|
0
|
|
|
|
|
0
|
$self->{output} .= $orig; |
52
|
0
|
|
|
|
|
0
|
return; |
53
|
|
|
|
|
|
|
} |
54
|
|
|
|
|
|
|
|
55
|
29
|
100
|
66
|
|
|
454
|
if (!$self->{regexp} || $u->path =~ m/$self->{regexp}/) { |
56
|
|
|
|
|
|
|
# get method |
57
|
25
|
100
|
100
|
|
|
1056
|
unless (($attr->{method} || '') =~ /^post$/i) { |
58
|
16
|
|
|
|
|
45
|
$self->{output} .= $orig; |
59
|
16
|
|
|
|
|
55
|
_sticky_input($self); |
60
|
16
|
|
|
|
|
495
|
return; |
61
|
|
|
|
|
|
|
} |
62
|
|
|
|
|
|
|
|
63
|
|
|
|
|
|
|
# post method |
64
|
9
|
50
|
|
|
|
33
|
if ($self->{keep_original}) { |
65
|
9
|
|
|
|
|
18
|
my %original; |
66
|
9
|
|
|
|
|
60
|
my @original = $u->query_form; |
67
|
9
|
|
|
|
|
236
|
while (my ($key, $val) = splice(@original, 0, 2)) { |
68
|
2
|
50
|
|
|
|
8
|
if (exists $original{$key}) { |
69
|
0
|
0
|
|
|
|
0
|
if (ref $original{$key} eq 'ARRAY') { |
70
|
0
|
|
|
|
|
0
|
push @{ $original{$key} }, $val; |
|
0
|
|
|
|
|
0
|
|
71
|
|
|
|
|
|
|
} else { |
72
|
0
|
|
|
|
|
0
|
$original{$key} = [ $original{$key}, $val ]; |
73
|
|
|
|
|
|
|
} |
74
|
|
|
|
|
|
|
} else { |
75
|
2
|
|
|
|
|
10
|
$original{$key} = $val; |
76
|
|
|
|
|
|
|
} |
77
|
|
|
|
|
|
|
} |
78
|
9
|
100
|
|
|
|
260
|
$u->query_form( %original, (exists $self->{param}->{guid} ? (guid => $self->{param}->{guid}) : ()) ); |
79
|
|
|
|
|
|
|
} else { |
80
|
0
|
|
|
|
|
0
|
$u->query_form(%{$self->{param}}); |
|
0
|
|
|
|
|
0
|
|
81
|
|
|
|
|
|
|
} |
82
|
|
|
|
|
|
|
|
83
|
9
|
|
|
|
|
430
|
$self->{output} .= "<$tagname"; |
84
|
|
|
|
|
|
|
# save attr order. |
85
|
9
|
|
|
|
|
19
|
for my $key (@{ $attrseq }) { |
|
9
|
|
|
|
|
22
|
|
86
|
18
|
100
|
|
|
|
216
|
if ($key eq 'action'){ |
|
|
50
|
|
|
|
|
|
87
|
9
|
|
|
|
|
50
|
$self->{output} .= sprintf ' action="%s"', $self->escapeHTML($u->as_string); |
88
|
|
|
|
|
|
|
} elsif ($attr->{$key} eq '__BOOLEAN__') { |
89
|
0
|
|
|
|
|
0
|
$self->{output} .= " $key"; |
90
|
|
|
|
|
|
|
} else { |
91
|
9
|
|
|
|
|
46
|
$self->{output} .= sprintf qq{ $key="%s"}, $self->escapeHTML($attr->{$key}); |
92
|
|
|
|
|
|
|
} |
93
|
|
|
|
|
|
|
} |
94
|
9
|
|
|
|
|
96
|
$self->{output} .= '>'; |
95
|
|
|
|
|
|
|
# add some params |
96
|
9
|
|
|
|
|
29
|
_sticky_input($self, 1); |
97
|
9
|
|
|
|
|
120
|
return; |
98
|
|
|
|
|
|
|
} |
99
|
|
|
|
|
|
|
|
100
|
4
|
|
|
|
|
121
|
$self->{output} .= $orig; |
101
|
|
|
|
|
|
|
} |
102
|
|
|
|
|
|
|
|
103
|
|
|
|
|
|
|
sub _sticky_input { |
104
|
25
|
|
|
25
|
|
48
|
my($self, $ignore_guid) = @_; |
105
|
25
|
|
|
|
|
45
|
while (my($key, $value) = each %{ $self->{param} }) { |
|
50
|
|
|
|
|
258
|
|
106
|
25
|
100
|
100
|
|
|
104
|
next if $ignore_guid && $key eq 'guid'; |
107
|
18
|
100
|
|
|
|
149
|
$self->{output} .= sprintf '', |
108
|
|
|
|
|
|
|
$key, $value, ($self->{use_xhtml} ? ' /' : ''); |
109
|
|
|
|
|
|
|
} |
110
|
|
|
|
|
|
|
} |
111
|
|
|
|
|
|
|
|
112
|
|
|
|
|
|
|
1; |
113
|
|
|
|
|
|
|
__END__ |