File Coverage

blib/lib/PDF/API2/Basic/PDF/Bool.pm
Criterion Covered Total %
statement 7 8 87.5
branch 1 2 50.0
condition n/a
subroutine 3 4 75.0
pod 2 2 100.0
total 13 16 81.2


line stmt bran cond sub pod time code
1             # Code in the PDF::API2::Basic::PDF namespace was originally copied from the
2             # Text::PDF distribution.
3             #
4             # Copyright Martin Hosken
5             #
6             # Martin Hosken's code may be used under the terms of the MIT license.
7             # Subsequent versions of the code have the same license as PDF::API2.
8              
9             package PDF::API2::Basic::PDF::Bool;
10              
11 40     40   273 use base 'PDF::API2::Basic::PDF::String';
  40         125  
  40         17971  
12              
13 40     40   285 use strict;
  40         87  
  40         3572  
14              
15             our $VERSION = '2.044'; # VERSION
16              
17             =head1 NAME
18              
19             PDF::API2::Basic::PDF::Bool - Low-level PDF boolean object
20             B or B
21              
22             =head1 METHODS
23              
24             =head2 $b->convert($str)
25              
26             Converts a string into the string which will be stored.
27              
28             =cut
29              
30             sub convert {
31 0     0 1 0 return $_[1] eq 'true';
32             }
33              
34             =head2 as_pdf
35              
36             Converts the value to a PDF output form
37              
38             =cut
39              
40             sub as_pdf {
41 2 50   2 1 9 return $_[0]->{'val'} ? 'true' : 'false';
42             }
43              
44             1;