JavaScript/Serializer/Form.pm

filter: Statementstmt 51.6% 16 / 31 Branchbran n/a Conditioncond n/a MC/DCmcdc n/a Subroutinesub 55.5% 5 / 9 Podpod 66.6% 2 / 3 totaltotal 53.4% 23 / 43 CC 1 SCAR 3.2
CC
1
Cov
52%
form_response
2.0
__ANON__
2.0
value_to_string
2.0
CRAP 1.4
« JavaScript/Serializer.pm ↑ Summary JavaScript/Variable.pm »
1 1 ▶use strict;
Subroutine BEGIN: called CC=1 SCAR=0.0
2 1 ▶use warnings FATAL => 'all';
Subroutine BEGIN: called CC=1 SCAR=0.0
3  
4 package HTML::Tested::JavaScript::Serializer::Form;
5 1 ▶use base 'HTML::Tested::Value';
Subroutine BEGIN: called CC=1 SCAR=0.0
6 1 ▶use HTML::Tested::JavaScript::Variable;
Subroutine BEGIN: called CC=1 SCAR=0.0
7  
8 0 ▶sub form_response {
Subroutine form_response: not called CC=1 SCAR=6.9
Pod undocumented
9 0 my ($self, $name, @args) = @_;
10 0 my $htjv = 'HTML::Tested::JavaScript::Variable';
11 0 my $al = join(", ", map { $htjv->encode_value($_) } @args);
12 return <<ENDS
13 <html>
14 <head>
15 <script>
16 top.on_$name\_response($al);
17 </script>
18 </head>
19 <body></body>
20 </html>
21 ENDS
22 0 }
23  
24 0 ▶sub new {
Subroutine new: not called CC=1 SCAR=3.3
Pod documented
25 0 my ($class, $parent, $name, %args) = @_;
26 0 my $self = $class->SUPER::new($parent, $name, %args);
27 {
28 0 ▶ no strict 'refs';
Subroutine BEGIN: called CC=1 SCAR=0.2
29 0 ▶ *{ "$parent\::$name\_response" } = sub {
Subroutine __ANON__: not called CC=1 SCAR=6.9
30 0 my $par = shift;
31 0 return $self->form_response($name, @_);
32 0 };
33 };
34 0 return $self;
35 }
36  
37 0 ▶sub value_to_string {
Subroutine value_to_string: not called CC=1 SCAR=6.9
Pod documented
38 0 my ($self, $name, $val) = @_;
39 return <<ENDS
40 <iframe id="$name\_iframe" name="$name\_iframe" style="display:none;"></iframe>
41 <form id="$name" name="$name" method="post" action="$val"
42 enctype="multipart/form-data" target="$name\_iframe">
43 ENDS
44 0 }
45  
46 1 1;
« JavaScript/Serializer.pm ↑ Summary JavaScript/Variable.pm »