File Coverage

blib/lib/PDF/Builder/Basic/PDF/Null.pm
Criterion Covered Total %
statement 13 17 76.4
branch n/a
condition n/a
subroutine 5 9 55.5
pod 6 6 100.0
total 24 32 75.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::Null;
17              
18 42     42   308 use base 'PDF::Builder::Basic::PDF::Objind';
  42         96  
  42         6025  
19              
20 42     42   303 use strict;
  42         94  
  42         1121  
21 42     42   263 use warnings;
  42         93  
  42         12084  
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::Null - PDF Null type object
29              
30             This is a subclass of PDF::Builder::Basic::PDF::Objind and cannot be subclassed
31              
32             =head1 METHODS
33              
34             =cut
35              
36             # There is only one null object (section 3.2.8).
37             my $null_obj = bless {}, 'PDF::Builder::Basic::PDF::Null';
38              
39             =head2 new
40              
41             PDF::Builder::Basic::PDF::Null->new()
42              
43             =over
44              
45             Returns the null object. There is only one null object.
46              
47             =back
48              
49             =cut
50              
51             sub new {
52 12     12 1 34 return $null_obj;
53             }
54              
55             =head2 realise
56              
57             $s->realise()
58              
59             =over
60              
61             Pretends to finish reading the object.
62              
63             =back
64              
65             =cut
66              
67             sub realise {
68 0     0 1 0 return $null_obj;
69             }
70              
71             =head2 outobjdeep
72              
73             $s->outobjdeep()
74              
75             =over
76              
77             Output the object in PDF format.
78              
79             =back
80              
81             =cut
82              
83             sub outobjdeep {
84 12     12 1 20 my ($self, $fh, $pdf) = @_;
85              
86 12         30 $fh->print('null');
87 12         60 return;
88             }
89              
90             =head2 is_obj
91              
92             $s->is_obj()
93              
94             =over
95              
96             Returns false because null is not a full object.
97              
98             =back
99              
100             =cut
101              
102             sub is_obj {
103 0     0 1   return 0;
104             }
105              
106             =head2 copy
107              
108             $s->copy()
109              
110             =over
111              
112             Another no-op.
113              
114             =back
115              
116             =cut
117              
118             sub copy {
119 0     0 1   return $null_obj;
120             }
121              
122             =head2 val
123              
124             $s->val()
125              
126             =over
127              
128             Return undef.
129              
130             =back
131              
132             =cut
133              
134             sub val {
135 0     0 1   return undef; ## no critic (undef is intentional)
136             }
137              
138             1;