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 41     41   278 use base 'PDF::Builder::Basic::PDF::Objind';
  41         86  
  41         4172  
19              
20 41     41   232 use strict;
  41         81  
  41         727  
21 41     41   170 use warnings;
  41         72  
  41         7217  
22              
23             our $VERSION = '3.024'; # VERSION
24             our $LAST_UPDATE = '3.024'; # 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             =over
34              
35             =cut
36              
37             # There is only one null object (section 3.2.8).
38             my $null_obj = bless {}, 'PDF::Builder::Basic::PDF::Null';
39              
40             =item PDF::Builder::Basic::PDF::Null->new()
41              
42             Returns the null object. There is only one null object.
43              
44             =cut
45              
46             sub new {
47 12     12 1 27 return $null_obj;
48             }
49              
50             =item $s->realise()
51              
52             Pretends to finish reading the object.
53              
54             =cut
55              
56             sub realise {
57 0     0 1 0 return $null_obj;
58             }
59              
60             =item $s->outobjdeep()
61              
62             Output the object in PDF format.
63              
64             =cut
65              
66             sub outobjdeep {
67 12     12 1 18 my ($self, $fh, $pdf) = @_;
68              
69 12         25 $fh->print('null');
70 12         74 return;
71             }
72              
73             =item $s->is_obj()
74              
75             Returns false because null is not a full object.
76              
77             =cut
78              
79             sub is_obj {
80 0     0 1   return 0;
81             }
82              
83             =item $s->copy()
84              
85             Another no-op.
86              
87             =cut
88              
89             sub copy {
90 0     0 1   return $null_obj;
91             }
92              
93             =item $s->val()
94              
95             Return undef.
96              
97             =cut
98              
99             sub val {
100 0     0 1   return undef; ## no critic (undef is intentional)
101             }
102              
103             =back
104              
105             =cut
106              
107             1;