File Coverage

blib/lib/PDF/Builder/Basic/PDF/Bool.pm
Criterion Covered Total %
statement 10 11 90.9
branch 1 2 50.0
condition n/a
subroutine 4 5 80.0
pod 2 2 100.0
total 17 20 85.0


line stmt bran cond sub pod time code
1             #=======================================================================
2             #
3             # THIS IS A REUSED PERL MODULE, FOR PROPER LICENCING TERMS SEE BELOW:
4             #
5             # Copyright Martin Hosken <Martin_Hosken@sil.org>
6             #
7             # No warranty or expression of effectiveness, least of all regarding
8             # anyone's safety, is implied in this software or documentation.
9             #
10             # This specific module is licensed under the Perl Artistic License.
11             # Effective 28 January 2021, the original author and copyright holder,
12             # Martin Hosken, has given permission to use and redistribute this module
13             # under the MIT license.
14             #
15             #=======================================================================
16             package PDF::Builder::Basic::PDF::Bool;
17              
18 42     42   310 use base 'PDF::Builder::Basic::PDF::String';
  42         91  
  42         23603  
19              
20 42     42   484 use strict;
  42         195  
  42         1161  
21 42     42   244 use warnings;
  42         81  
  42         6817  
22              
23             our $VERSION = '3.028'; # VERSION
24             our $LAST_UPDATE = '3.027'; # manually update whenever code is changed
25              
26             =head1 NAME
27              
28             PDF::Builder::Basic::PDF::Bool - Holds the strings B<true> or B<false>
29              
30             Inherits from L<PDF::Builder::Basic::PDF::String>
31              
32             =head1 METHODS
33              
34             =head2 convert
35              
36             $b->convert($str)
37              
38             =over
39              
40             Converts a string into the string which will be stored.
41              
42             =back
43              
44             =cut
45              
46             sub convert {
47 0     0 1 0 return $_[1] eq 'true';
48             }
49              
50             =head2 as_pdf
51              
52             $b->as_pdf()
53              
54             =over
55              
56             Converts the value to a PDF output form.
57              
58             =back
59              
60             =cut
61              
62             sub as_pdf {
63 4 50   4 1 21 return $_[0]->{'val'}? 'true': 'false';
64             }
65              
66             1;