File Coverage

blib/lib/PDF/API2/Basic/PDF/Null.pm
Criterion Covered Total %
statement 9 13 69.2
branch n/a
condition n/a
subroutine 4 8 50.0
pod 6 6 100.0
total 19 27 70.3


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::Null;
10              
11 41     41   296 use base 'PDF::API2::Basic::PDF::Objind';
  41         86  
  41         4021  
12              
13 41     41   269 use strict;
  41         82  
  41         6603  
14              
15             our $VERSION = '2.045'; # VERSION
16              
17             =head1 NAME
18              
19             PDF::API2::Basic::PDF::Null - Low-level PDF null object
20              
21             =head1 METHODS
22              
23             =cut
24              
25             # There is only one null object (section 3.2.8).
26             my $null_obj = bless {}, 'PDF::API2::Basic::PDF::Null';
27              
28             =head2 PDF::API2::Basic::PDF::Null->new
29              
30             Returns the null object. There is only one null object.
31              
32             =cut
33              
34             sub new {
35 12     12 1 42 return $null_obj;
36             }
37              
38             =head2 $s->realise
39              
40             Pretends to finish reading the object.
41              
42             =cut
43              
44             sub realise {
45 0     0 1 0 return $null_obj;
46             }
47              
48             =head2 $s->outobjdeep
49              
50             Output the object in PDF format.
51              
52             =cut
53              
54             sub outobjdeep {
55 12     12 1 22 my ($self, $fh, $pdf) = @_;
56 12         23 $fh->print('null');
57             }
58              
59             =head2 $s->is_obj
60              
61             Returns false because null is not a full object.
62              
63             =cut
64              
65             sub is_obj {
66 0     0 1   return 0;
67             }
68              
69             =head2 $s->copy
70              
71             Another no-op.
72              
73             =cut
74              
75             sub copy {
76 0     0 1   return $null_obj;
77             }
78              
79             =head2 $s->val
80              
81             Return undef.
82              
83             =cut
84              
85             sub val {
86 0     0 1   return undef; ## no critic (undef is intentional)
87             }
88              
89             1;