File Coverage

blib/lib/PDF/API2/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::API2::Resource::XObject;
2              
3 38     38   362 use base 'PDF::API2::Resource';
  38         94  
  38         16797  
4              
5 38     38   304 use strict;
  38         84  
  38         793  
6 38     38   212 use warnings;
  38         95  
  38         1537  
7              
8             our $VERSION = '2.044'; # VERSION
9              
10 38     38   228 use PDF::API2::Basic::PDF::Utils;
  38         93  
  38         6800  
11              
12             =head1 NAME
13              
14             PDF::API2::Resource::XObject - Base class for external objects
15              
16             =head1 METHODS
17              
18             =over
19              
20             =item $xobject = PDF::API2::Resource::XObject->new($pdf, $name)
21              
22             Creates an XObject resource.
23              
24             =cut
25              
26             sub new {
27 28     28 1 84 my ($class, $pdf, $name) = @_;
28 28         157 my $self = $class->SUPER::new($pdf, $name);
29              
30 28         220 $self->type('XObject');
31              
32 28         69 return $self;
33             }
34              
35             =item $type = $xobject->subtype($type)
36              
37             Get or set the Subtype of the XObject resource.
38              
39             =cut
40              
41             sub subtype {
42 28     28 1 61 my $self = shift();
43 28 50       105 if (scalar @_) {
44 28         88 $self->{'Subtype'} = PDFName(shift());
45             }
46 28         90 return $self->{'Subtype'}->val();
47             }
48              
49             =back
50              
51             =cut
52              
53             1;