line |
stmt |
bran |
cond |
sub |
pod |
time |
code |
1
|
|
|
|
|
|
|
package PDF::Builder::Resource; |
2
|
|
|
|
|
|
|
|
3
|
38
|
|
|
38
|
|
289
|
use base 'PDF::Builder::Basic::PDF::Dict'; |
|
38
|
|
|
|
|
104
|
|
|
38
|
|
|
|
|
3639
|
|
4
|
|
|
|
|
|
|
|
5
|
38
|
|
|
38
|
|
239
|
use strict; |
|
38
|
|
|
|
|
74
|
|
|
38
|
|
|
|
|
805
|
|
6
|
38
|
|
|
38
|
|
169
|
use warnings; |
|
38
|
|
|
|
|
82
|
|
|
38
|
|
|
|
|
2242
|
|
7
|
|
|
|
|
|
|
|
8
|
|
|
|
|
|
|
our $VERSION = '3.024'; # VERSION |
9
|
|
|
|
|
|
|
our $LAST_UPDATE = '3.024'; # manually update whenever code is changed |
10
|
|
|
|
|
|
|
|
11
|
38
|
|
|
38
|
|
248
|
use PDF::Builder::Util qw(pdfkey); |
|
38
|
|
|
|
|
76
|
|
|
38
|
|
|
|
|
3659
|
|
12
|
38
|
|
|
38
|
|
247
|
use PDF::Builder::Basic::PDF::Utils; # PDFName |
|
38
|
|
|
|
|
80
|
|
|
38
|
|
|
|
|
2848
|
|
13
|
|
|
|
|
|
|
|
14
|
38
|
|
|
38
|
|
245
|
use Scalar::Util qw(weaken); |
|
38
|
|
|
|
|
76
|
|
|
38
|
|
|
|
|
8421
|
|
15
|
|
|
|
|
|
|
|
16
|
|
|
|
|
|
|
=head1 NAME |
17
|
|
|
|
|
|
|
|
18
|
|
|
|
|
|
|
PDF::Builder::Resource - Base class for PDF resources. Inherit from L |
19
|
|
|
|
|
|
|
|
20
|
|
|
|
|
|
|
=head1 METHODS |
21
|
|
|
|
|
|
|
|
22
|
|
|
|
|
|
|
=over |
23
|
|
|
|
|
|
|
|
24
|
|
|
|
|
|
|
=item $resource = PDF::Builder::Resource->new($pdf, $name) |
25
|
|
|
|
|
|
|
|
26
|
|
|
|
|
|
|
Returns a resource object. |
27
|
|
|
|
|
|
|
|
28
|
|
|
|
|
|
|
=cut |
29
|
|
|
|
|
|
|
|
30
|
|
|
|
|
|
|
sub new { |
31
|
83
|
|
|
83
|
1
|
175
|
my ($class, $pdf, $name) = @_; |
32
|
|
|
|
|
|
|
|
33
|
83
|
50
|
|
|
|
207
|
$class = ref($class) if ref($class); |
34
|
|
|
|
|
|
|
|
35
|
83
|
|
|
|
|
569
|
my $self = $class->SUPER::new(); |
36
|
|
|
|
|
|
|
|
37
|
83
|
50
|
|
|
|
423
|
$pdf->new_obj($self) unless $self->is_obj($pdf); |
38
|
|
|
|
|
|
|
|
39
|
83
|
|
66
|
|
|
406
|
$self->name($name or pdfkey()); |
40
|
|
|
|
|
|
|
|
41
|
83
|
|
|
|
|
172
|
$self->{' apipdf'} = $pdf; |
42
|
83
|
|
|
|
|
366
|
weaken $self->{' apipdf'}; |
43
|
|
|
|
|
|
|
|
44
|
83
|
|
|
|
|
190
|
return $self; |
45
|
|
|
|
|
|
|
} |
46
|
|
|
|
|
|
|
|
47
|
|
|
|
|
|
|
# Note: new_api() removed in favor of new(): |
48
|
|
|
|
|
|
|
# new_api($api, ...) replace with new($api->{'pdf'}, ...) |
49
|
|
|
|
|
|
|
|
50
|
|
|
|
|
|
|
=item $name = $resource->name() # Get |
51
|
|
|
|
|
|
|
|
52
|
|
|
|
|
|
|
=item $resource->name($name) # Set |
53
|
|
|
|
|
|
|
|
54
|
|
|
|
|
|
|
Get or set the name of the resource. |
55
|
|
|
|
|
|
|
|
56
|
|
|
|
|
|
|
=cut |
57
|
|
|
|
|
|
|
|
58
|
|
|
|
|
|
|
sub name { |
59
|
145
|
|
|
145
|
1
|
263
|
my $self = shift @_; |
60
|
145
|
100
|
66
|
|
|
488
|
if (scalar @_ and defined $_[0]) { |
61
|
83
|
|
|
|
|
295
|
$self->{'Name'} = PDFName($_[0]); |
62
|
|
|
|
|
|
|
} |
63
|
145
|
|
|
|
|
465
|
return $self->{'Name'}->val(); |
64
|
|
|
|
|
|
|
} |
65
|
|
|
|
|
|
|
|
66
|
|
|
|
|
|
|
#sub outobjdeep { |
67
|
|
|
|
|
|
|
# my ($self, $fh, $pdf, %options) = @_; |
68
|
|
|
|
|
|
|
# |
69
|
|
|
|
|
|
|
# delete $self->{' api'}; |
70
|
|
|
|
|
|
|
# delete $self->{' apipdf'}; |
71
|
|
|
|
|
|
|
# return $self->SUPER::outobjdeep($fh, $pdf, %options); |
72
|
|
|
|
|
|
|
#} |
73
|
|
|
|
|
|
|
|
74
|
|
|
|
|
|
|
=back |
75
|
|
|
|
|
|
|
|
76
|
|
|
|
|
|
|
=cut |
77
|
|
|
|
|
|
|
|
78
|
|
|
|
|
|
|
1; |