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
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 37     37   275 use base 'PDF::Builder::Basic::PDF::Objind';
  37         78  
  37         4300  
19              
20 37     37   286 use strict;
  37         82  
  37         838  
21 37     37   199 use warnings;
  37         94  
  37         7930  
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::Null - PDF Null type object. This is a subclass of
29             PDF::Builder::Basic::PDF::Objind and cannot be subclassed.
30              
31             =head1 METHODS
32              
33             =cut
34              
35             # There is only one null object (section 3.2.8).
36             my $null_obj = bless {}, 'PDF::Builder::Basic::PDF::Null';
37              
38             =head2 PDF::Builder::Basic::PDF::Null->new()
39              
40             Returns the null object. There is only one null object.
41              
42             =cut
43              
44             sub new {
45 3     3 1 11 return $null_obj;
46             }
47              
48             =head2 $s->realise()
49              
50             Pretends to finish reading the object.
51              
52             =cut
53              
54             sub realise {
55 0     0 1 0 return $null_obj;
56             }
57              
58             =head2 $s->outobjdeep()
59              
60             Output the object in PDF format.
61              
62             =cut
63              
64             sub outobjdeep {
65 3     3 1 6 my ($self, $fh, $pdf) = @_;
66              
67 3         9 $fh->print('null');
68 3         17 return;
69             }
70              
71             =head2 $s->is_obj()
72              
73             Returns false because null is not a full object.
74              
75             =cut
76              
77             sub is_obj {
78 0     0 1   return 0;
79             }
80              
81             =head2 $s->copy()
82              
83             Another no-op.
84              
85             =cut
86              
87             sub copy {
88 0     0 1   return $null_obj;
89             }
90              
91             =head2 $s->val()
92              
93             Return undef.
94              
95             =cut
96              
97             sub val {
98 0     0 1   return undef; ## no critic (undef is intentional)
99             }
100              
101             1;