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 39     39   337 use base 'PDF::API2::Resource';
  39         95  
  39         24513  
4              
5 39     39   284 use strict;
  39         73  
  39         943  
6 39     39   181 use warnings;
  39         82  
  39         2726  
7              
8             our $VERSION = '2.048'; # VERSION
9              
10 39     39   298 use PDF::API2::Basic::PDF::Utils;
  39         122  
  39         9647  
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 79 my ($class, $pdf, $name) = @_;
28 28         227 my $self = $class->SUPER::new($pdf, $name);
29              
30 28         197 $self->type('XObject');
31              
32 28         95 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 58 my $self = shift();
43 28 50       87 if (scalar @_) {
44 28         115 $self->{'Subtype'} = PDFName(shift());
45             }
46 28         121 return $self->{'Subtype'}->val();
47             }
48              
49             =back
50              
51             =cut
52              
53             1;