line |
stmt |
bran |
cond |
sub |
pod |
time |
code |
1
|
|
|
|
|
|
|
package PDF::API2::Resource; |
2
|
|
|
|
|
|
|
|
3
|
38
|
|
|
38
|
|
340
|
use base 'PDF::API2::Basic::PDF::Dict'; |
|
38
|
|
|
|
|
93
|
|
|
38
|
|
|
|
|
4213
|
|
4
|
|
|
|
|
|
|
|
5
|
38
|
|
|
38
|
|
283
|
use strict; |
|
38
|
|
|
|
|
92
|
|
|
38
|
|
|
|
|
828
|
|
6
|
38
|
|
|
38
|
|
208
|
use warnings; |
|
38
|
|
|
|
|
90
|
|
|
38
|
|
|
|
|
2237
|
|
7
|
|
|
|
|
|
|
|
8
|
|
|
|
|
|
|
our $VERSION = '2.044'; # VERSION |
9
|
|
|
|
|
|
|
|
10
|
38
|
|
|
38
|
|
283
|
use PDF::API2::Util qw(pdfkey); |
|
38
|
|
|
|
|
99
|
|
|
38
|
|
|
|
|
3569
|
|
11
|
38
|
|
|
38
|
|
284
|
use PDF::API2::Basic::PDF::Utils; # PDFName |
|
38
|
|
|
|
|
162
|
|
|
38
|
|
|
|
|
3290
|
|
12
|
|
|
|
|
|
|
|
13
|
38
|
|
|
38
|
|
273
|
use Scalar::Util qw(weaken); |
|
38
|
|
|
|
|
91
|
|
|
38
|
|
|
|
|
12178
|
|
14
|
|
|
|
|
|
|
|
15
|
|
|
|
|
|
|
=head1 NAME |
16
|
|
|
|
|
|
|
|
17
|
|
|
|
|
|
|
PDF::API2::Resource - Base class for PDF resources |
18
|
|
|
|
|
|
|
|
19
|
|
|
|
|
|
|
=head1 METHODS |
20
|
|
|
|
|
|
|
|
21
|
|
|
|
|
|
|
=over |
22
|
|
|
|
|
|
|
|
23
|
|
|
|
|
|
|
=item $resource = PDF::API2::Resource->new($pdf, $name) |
24
|
|
|
|
|
|
|
|
25
|
|
|
|
|
|
|
Returns a resource object. |
26
|
|
|
|
|
|
|
|
27
|
|
|
|
|
|
|
=cut |
28
|
|
|
|
|
|
|
|
29
|
|
|
|
|
|
|
sub new { |
30
|
85
|
|
|
85
|
1
|
258
|
my ($class, $pdf, $name) = @_; |
31
|
85
|
50
|
|
|
|
246
|
$class = ref($class) if ref($class); |
32
|
|
|
|
|
|
|
|
33
|
85
|
|
|
|
|
418
|
my $self = $class->SUPER::new(); |
34
|
|
|
|
|
|
|
|
35
|
85
|
50
|
|
|
|
448
|
$pdf->new_obj($self) unless $self->is_obj($pdf); |
36
|
|
|
|
|
|
|
|
37
|
85
|
|
66
|
|
|
507
|
$self->name($name or pdfkey()); |
38
|
|
|
|
|
|
|
|
39
|
85
|
|
|
|
|
209
|
$self->{' apipdf'} = $pdf; |
40
|
85
|
|
|
|
|
376
|
weaken $self->{' apipdf'}; |
41
|
|
|
|
|
|
|
|
42
|
85
|
|
|
|
|
235
|
return $self; |
43
|
|
|
|
|
|
|
} |
44
|
|
|
|
|
|
|
|
45
|
|
|
|
|
|
|
# Deprecated (warning added in 2.031) |
46
|
|
|
|
|
|
|
sub new_api { |
47
|
1
|
|
|
1
|
0
|
24
|
my ($class, $api2, @options) = @_; |
48
|
1
|
|
|
|
|
175
|
warnings::warnif('deprecated', q{Call to deprecated method "new_api($api2, ...)". Replace with "new($api2->{'pdf'}, ...)"}); |
49
|
|
|
|
|
|
|
|
50
|
1
|
|
|
|
|
12
|
my $resource = $class->new($api2->{'pdf'}, @options); |
51
|
1
|
|
|
|
|
6
|
return $resource; |
52
|
|
|
|
|
|
|
} |
53
|
|
|
|
|
|
|
|
54
|
|
|
|
|
|
|
=item $name = $resource->name() |
55
|
|
|
|
|
|
|
|
56
|
|
|
|
|
|
|
=item $resource->name($name) |
57
|
|
|
|
|
|
|
|
58
|
|
|
|
|
|
|
Get or set the name of the resource. |
59
|
|
|
|
|
|
|
|
60
|
|
|
|
|
|
|
=cut |
61
|
|
|
|
|
|
|
|
62
|
|
|
|
|
|
|
sub name { |
63
|
149
|
|
|
149
|
1
|
328
|
my $self = shift @_; |
64
|
149
|
100
|
66
|
|
|
668
|
if (scalar @_ and defined $_[0]) { |
65
|
85
|
|
|
|
|
338
|
$self->{'Name'} = PDFName($_[0]); |
66
|
|
|
|
|
|
|
} |
67
|
149
|
|
|
|
|
587
|
return $self->{'Name'}->val(); |
68
|
|
|
|
|
|
|
} |
69
|
|
|
|
|
|
|
|
70
|
|
|
|
|
|
|
=back |
71
|
|
|
|
|
|
|
|
72
|
|
|
|
|
|
|
=cut |
73
|
|
|
|
|
|
|
|
74
|
|
|
|
|
|
|
1; |