File Coverage

blib/lib/UI/Various/PoorTerm/Check.pm
Criterion Covered Total %
statement 29 29 100.0
branch 4 4 100.0
condition n/a
subroutine 10 10 100.0
pod n/a
total 43 43 100.0


line stmt bran cond sub pod time code
1             package UI::Various::PoorTerm::Check;
2              
3             # Author, Copyright and License: see end of file
4              
5             =head1 NAME
6              
7             UI::Various::PoorTerm::Check - concrete implementation of L
8              
9             =head1 SYNOPSIS
10              
11             # This module should never be used directly!
12             # It is used indirectly via the following:
13             use UI::Various::Check;
14              
15             =head1 ABSTRACT
16              
17             This module is the specific minimal fallback implementation of
18             L. It manages and hides everything specific to the last
19             resort UI.
20              
21             =head1 DESCRIPTION
22              
23             The documentation of this module is only intended for developers of the
24             package itself.
25              
26             =cut
27              
28             #########################################################################
29              
30 2     2   16 use v5.14;
  2         6  
31 2     2   8 use strictures;
  2         2  
  2         16  
32 2     2   236 no indirect 'fatal';
  2         4  
  2         8  
33 2     2   172 no multidimensional;
  2         2  
  2         14  
34 2     2   54 use warnings 'once';
  2         4  
  2         112  
35              
36             our $VERSION = '0.23';
37              
38 2     2   9 use UI::Various::core;
  2         4  
  2         8  
39 2     2   10 use UI::Various::Check;
  2         3  
  2         50  
40 2     2   295 use UI::Various::PoorTerm::base;
  2         8  
  2         382  
41              
42             require Exporter;
43             our @ISA = qw(UI::Various::Check UI::Various::PoorTerm::base);
44             our @EXPORT_OK = qw();
45              
46             #########################################################################
47             #########################################################################
48              
49             =head1 METHODS
50              
51             =cut
52              
53             #########################################################################
54              
55             =head2 B<_show> - print UI element
56              
57             $ui_element->_show($prefix);
58              
59             =head3 example:
60              
61             $_->_show('(1) ');
62              
63             =head3 parameters:
64              
65             $prefix text in front of first line
66              
67             =head3 description:
68              
69             Show (print) the UI element. I
70             UI::Various::PoorTerm container elements!>
71              
72             =cut
73              
74             # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # #
75              
76             sub _show($$)
77             {
78 2     2   2168 my ($self, $prefix) = @_;
79             # Note that the accessors automatically dereference the SCALARs here:
80 2 100       12 local $_ = $prefix . '[' . ($self->var ? 'X' : ' ') . '] ';
81 2         18 print $self->_wrap($_, $self->text), "\n";
82             }
83              
84             #########################################################################
85              
86             =head2 B<_process> - handle action of UI element
87              
88             $ui_element->_process;
89              
90             =head3 description:
91              
92             Handle the action of the UI element (invert the checkbox).
93              
94             =cut
95              
96             # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # #
97              
98             sub _process($)
99             {
100 2     2   591 my ($self) = @_;
101              
102             # only dereference reading the SCALAR:
103 2 100       5 ${$self->{var}} = $self->var ? 0 : 1; # invert value
  2         4  
104             }
105              
106             1;
107              
108             #########################################################################
109             #########################################################################
110              
111             =head1 SEE ALSO
112              
113             L, L
114              
115             =head1 LICENSE
116              
117             Copyright (C) Thomas Dorner.
118              
119             This library is free software; you can redistribute it and/or modify it
120             under the same terms as Perl itself. See LICENSE file for more details.
121              
122             =head1 AUTHOR
123              
124             Thomas Dorner Edorner (at) cpan (dot) orgE
125              
126             =cut