Test/Form/Widget/Hidden.pm

filter: Statementstmt 86.9% 20 / 23 Branchbran n/a Conditioncond n/a MC/DCmcdc n/a Subroutinesub 66.6% 6 / 9 Podpod 100% 3 / 3 totaltotal 82.8% 29 / 35 CC 1 SCAR 2.9
CC
1
Cov
87%
gui_type
2.0
is_read_only
2.0
is_hidden
2.0
CRAP 1.3
« Test/Form/Widget/Button/Plain.pm ↑ Summary Test/Form/Widget/Input.pm »
1 package CGI::Test::Form::Widget::Hidden;
2 14 ▶use strict;
Subroutine BEGIN: called CC=1 SCAR=0.0
3 14 ▶use warnings;
Subroutine BEGIN: called CC=1 SCAR=0.0
4 ##################################################################
5 # $Id: Hidden.pm 411 2011-09-26 11:19:30Z nohuhu@nohuhu.org $
6 # $Name: cgi-test_0-104_t1 $
7 ##################################################################
8 #
9 # Copyright (c) 2001, Raphael Manfredi
10 #
11 # You may redistribute only under the terms of the Artistic License,
12 # as specified in the README file that comes with the distribution.
13 #
14  
15 14 ▶use Carp;
Subroutine BEGIN: called CC=1 SCAR=0.0
16  
17 #
18 # This class models a FORM hidden field.
19 #
20  
21 14 ▶use base qw(CGI::Test::Form::Widget);
Subroutine BEGIN: called CC=1 SCAR=0.0
22  
23 #
24 # %attr
25 #
26 # Defines which HTML attributes we should look at within the node, and how
27 # to translate that into class attributes.
28 #
29  
30 14 my %attr = ('name' => 'name',
31 'value' => 'value',
32 'disabled' => 'is_disabled',
33 );
34  
35 #
36 # ->_init
37 #
38 # Per-widget initialization routine.
39 # Parse HTML node to determine our specific parameters.
40 #
41 sub _init
42 83 ▶{
Subroutine _init: called CC=1 SCAR=0.0
43 83 my $this = shift;
44 83 my ($node) = shift;
45 83 $this->_parse_attr($node, \%attr);
46 83 return;
47 }
48  
49 #
50 # ->_is_successful -- defined
51 #
52 # Is the enabled widget "successful", according to W3C's specs?
53 # Any hidden field with a VALUE attribute is.
54 #
55 sub _is_successful
56 97 ▶{
Subroutine _is_successful: called CC=1 SCAR=0.0
57 97 my $this = shift;
58 97 return defined $this->value();
59 }
60  
61 #
62 # Attribute access
63 #
64  
65 sub gui_type
66 0 ▶{
Subroutine gui_type: not called CC=1 SCAR=6.9
Pod documented
67 0 return "hidden field";
68 }
69  
70 #
71 # Global widget predicates
72 #
73  
74 sub is_read_only
75 0 ▶{
Subroutine is_read_only: not called CC=1 SCAR=6.9
Pod documented
76 0 return 1;
77 }
78  
79 #
80 # High-level classification predicates
81 #
82  
83 sub is_hidden
84 0 ▶{
Subroutine is_hidden: not called CC=1 SCAR=6.9
Pod documented
85 0 return 1;
86 }
87  
88 14 1;
89  
90 =head1 NAME
91  
92 CGI::Test::Form::Widget::Hidden - A hidden field
93  
94 =head1 SYNOPSIS
95  
96 # Inherits from CGI::Test::Form::Widget
97  
98 =head1 DESCRIPTION
99  
100 This class represents a hidden field, which is meant to be resent as-is
101 upon submit. Such a widget is therefore read-only.
102  
103 The interface is the same as the one described
104 in L<CGI::Test::Form::Widget>.
105  
106 =head1 AUTHORS
107  
108 The original author is Raphael Manfredi.
109  
110 Steven Hilton was long time maintainer of this module.
111  
112 Current maintainer is Alexander Tokarev F<E<lt>tokarev@cpan.orgE<gt>>.
113  
114 =head1 SEE ALSO
115  
116 CGI::Test::Form::Widget(3).
117  
118 =cut
119  
« Test/Form/Widget/Button/Plain.pm ↑ Summary Test/Form/Widget/Input.pm »