File Coverage

blib/lib/PDF/Builder/Resource/XObject.pm
Criterion Covered Total %
statement 20 20 100.0
branch 1 2 50.0
condition n/a
subroutine 6 6 100.0
pod 2 2 100.0
total 29 30 96.6


line stmt bran cond sub pod time code
1             package PDF::Builder::Resource::XObject;
2              
3 39     39   396 use base 'PDF::Builder::Resource';
  39         132  
  39         22049  
4              
5 39     39   290 use strict;
  39         88  
  39         1012  
6 39     39   218 use warnings;
  39         80  
  39         3087  
7              
8             our $VERSION = '3.028'; # VERSION
9             our $LAST_UPDATE = '3.027'; # manually update whenever code is changed
10              
11 39     39   279 use PDF::Builder::Basic::PDF::Utils;
  39         102  
  39         10853  
12              
13             =head1 NAME
14              
15             PDF::Builder::Resource::XObject - Base class for external objects
16              
17             Inherits from L<PDF::Builder::Resource>
18              
19             =head1 METHODS
20              
21             =head2 new
22              
23             $xobject = PDF::Builder::Resource::XObject->new($pdf, $name)
24              
25             =over
26              
27             Creates an XObject resource.
28              
29             =back
30              
31             =cut
32              
33             sub new {
34 27     27 1 73 my ($class, $pdf, $name) = @_;
35              
36 27         239 my $self = $class->SUPER::new($pdf, $name);
37              
38 27         210 $self->type('XObject');
39              
40 27         70 return $self;
41             }
42              
43             =head2 subtype
44              
45             $type = $xobject->subtype($type)
46              
47             =over
48              
49             Get or set the Subtype of the XObject resource.
50              
51             =back
52              
53             =cut
54              
55             sub subtype {
56 27     27 1 56 my $self = shift;
57              
58 27 50       77 if (scalar @_) {
59 27         81 $self->{'Subtype'} = PDFName(shift());
60             }
61 27         86 return $self->{'Subtype'}->val();
62             }
63              
64             1;