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
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 37     37   264 use base 'PDF::Builder::Basic::PDF::String';
  37         82  
  37         17940  
19              
20 37     37   271 use strict;
  37         87  
  37         763  
21 37     37   180 use warnings;
  37         75  
  37         3846  
22              
23             our $VERSION = '3.023'; # VERSION
24             our $LAST_UPDATE = '3.022'; # manually update whenever code is changed
25              
26             =head1 NAME
27              
28             PDF::Builder::Basic::PDF::Bool - A special form of
29             L which holds the strings
30             B or B
31              
32             =head1 METHODS
33              
34             =head2 $b->convert($str)
35              
36             Converts a string into the string which will be stored.
37              
38             =cut
39              
40             sub convert {
41 0     0 1 0 return $_[1] eq 'true';
42             }
43              
44             =head2 $b->as_pdf()
45              
46             Converts the value to a PDF output form.
47              
48             =cut
49              
50             sub as_pdf {
51 4 50   4 1 20 return $_[0]->{'val'}? 'true': 'false';
52             }
53              
54             1;