line |
stmt |
bran |
cond |
sub |
pod |
time |
code |
1
|
|
|
|
|
|
|
package Nephia::Plugin::FillInForm; |
2
|
2
|
|
|
2
|
|
5787
|
use 5.008005; |
|
2
|
|
|
|
|
6
|
|
|
2
|
|
|
|
|
70
|
|
3
|
2
|
|
|
2
|
|
9
|
use strict; |
|
2
|
|
|
|
|
4
|
|
|
2
|
|
|
|
|
62
|
|
4
|
2
|
|
|
2
|
|
20
|
use warnings; |
|
2
|
|
|
|
|
4
|
|
|
2
|
|
|
|
|
59
|
|
5
|
2
|
|
|
2
|
|
774
|
use parent 'Nephia::Plugin'; |
|
2
|
|
|
|
|
275
|
|
|
2
|
|
|
|
|
12
|
|
6
|
2
|
|
|
2
|
|
2943
|
use HTML::FillInForm; |
|
2
|
|
|
|
|
8059
|
|
|
2
|
|
|
|
|
485
|
|
7
|
|
|
|
|
|
|
|
8
|
|
|
|
|
|
|
our $VERSION = "0.20"; |
9
|
|
|
|
|
|
|
|
10
|
|
|
|
|
|
|
sub new { |
11
|
1
|
|
|
1
|
0
|
18
|
my ($class, %opts) = @_; |
12
|
1
|
|
|
|
|
10
|
my $self = $class->SUPER::new(%opts); |
13
|
1
|
|
|
|
|
60
|
$self->app->action_chain->append(FillInForm => $class->can('_fillin')); |
14
|
1
|
|
|
|
|
143
|
return $self; |
15
|
|
|
|
|
|
|
} |
16
|
|
|
|
|
|
|
|
17
|
2
|
|
|
2
|
1
|
46936
|
sub exports { qw/ fillin_form / }; |
18
|
|
|
|
|
|
|
|
19
|
|
|
|
|
|
|
sub fillin_form { |
20
|
4
|
|
|
4
|
1
|
20
|
my ($self, $context) = @_; |
21
|
|
|
|
|
|
|
sub { |
22
|
1
|
|
|
1
|
|
810
|
my $params = shift; |
23
|
1
|
|
|
|
|
4
|
$context->set(fillin => $params); |
24
|
4
|
|
|
|
|
58
|
}; |
25
|
|
|
|
|
|
|
} |
26
|
|
|
|
|
|
|
|
27
|
|
|
|
|
|
|
sub _fillin { |
28
|
2
|
|
|
2
|
|
594
|
my ($app, $context) = @_; |
29
|
2
|
|
|
|
|
5
|
my $params = $context->get('fillin'); |
30
|
2
|
100
|
|
|
|
22
|
if ($params) { |
31
|
1
|
|
|
|
|
3
|
my $res = $context->get('res'); |
32
|
1
|
50
|
|
|
|
6
|
if (ref($res->body) eq 'ARRAY') { |
33
|
0
|
|
|
|
|
0
|
my $body = $res->body->[0]; |
34
|
0
|
|
|
|
|
0
|
$res->body->[0] = HTML::FillInForm->fill(\$body, $params); |
35
|
|
|
|
|
|
|
} |
36
|
|
|
|
|
|
|
else { |
37
|
1
|
|
|
|
|
9
|
my $body = $res->body; |
38
|
1
|
|
|
|
|
17
|
$res->body(HTML::FillInForm->fill(\$body, $params)); |
39
|
|
|
|
|
|
|
} |
40
|
|
|
|
|
|
|
} |
41
|
2
|
|
|
|
|
6643
|
return $context; |
42
|
|
|
|
|
|
|
} |
43
|
|
|
|
|
|
|
|
44
|
|
|
|
|
|
|
1; |
45
|
|
|
|
|
|
|
__END__ |