API3/Compat/API2/Basic/PDF/Literal.pm

filter: Statementstmt 33.3% 19 / 57 Branchbran 0.0% 0 / 20 Conditioncond n/a MC/DCmcdc n/a Subroutinesub 60.0% 6 / 10 Podpod 75.0% 3 / 4 totaltotal 30.7% 28 / 91 CC 13 SCAR 37.9
CC
13
Cov
25%
outobjdeep
90.0
new
30.0
outxmldeep
2.0
CRAP 44.1
« API3/Compat/API2/Basic/TTF/Hhea.pm ↑ Summary API3/Compat/API2/Basic/TTF/Prop.pm »
1 #=======================================================================
2 # ____ ____ _____ _ ____ ___ ____
3 # | _ \| _ \| ___| _ _ / \ | _ \_ _| |___ \
4 # | |_) | | | | |_ (_) (_) / _ \ | |_) | | __) |
5 # | __/| |_| | _| _ _ / ___ \| __/| | / __/
6 # |_| |____/|_| (_) (_) /_/ \_\_| |___| |_____|
7 #
8 # A Perl Module Chain to faciliate the Creation and Modification
9 # of High-Quality "Portable Document Format (PDF)" Files.
10 #
11 # Copyright 1999-2005 Alfred Reibenschuh <areibens@cpan.org>.
12 #
13 #=======================================================================
14 #
15 # This library is free software; you can redistribute it and/or
16 # modify it under the terms of the GNU Lesser General Public
17 # License as published by the Free Software Foundation; either
18 # version 2 of the License, or (at your option) any later version.
19 #
20 # This library is distributed in the hope that it will be useful,
21 # but WITHOUT ANY WARRANTY; without even the implied warranty of
22 # MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
23 # Lesser General Public License for more details.
24 #
25 # You should have received a copy of the GNU Lesser General Public
26 # License along with this library; if not, write to the
27 # Free Software Foundation, Inc., 59 Temple Place - Suite 330,
28 # Boston, MA 02111-1307, USA.
29 #
30 # $Id: Literal.pm,v 2.0 2005/11/16 02:16:00 areibens Exp $
31 #
32 #=======================================================================
33 # Literal PDF Object for Dirty Hacks ...
34 package PDF::API3::Compat::API2::Basic::PDF::Literal;
35
36 1 ▶use strict;
Subroutine BEGIN: called CC=1 SCAR=0.0
37 1 ▶use vars qw( @ISA );
Subroutine BEGIN: called CC=1 SCAR=0.0
38
39 1 ▶use PDF::API3::Compat::API2::Basic::PDF::Objind;
Subroutine BEGIN: called CC=1 SCAR=0.0
40
41 1 @ISA = qw(PDF::API3::Compat::API2::Basic::PDF::Objind);
42
43 1 ▶use PDF::API3::Compat::API2::Basic::PDF::Filter;
Subroutine BEGIN: called CC=1 SCAR=0.0
44 1 ▶use PDF::API3::Compat::API2::Basic::PDF::Name;
Subroutine BEGIN: called CC=1 SCAR=0.0
45
46 1 ▶no warnings qw[ deprecated recursion uninitialized ];
Subroutine BEGIN: called CC=1 SCAR=0.0
47
48 sub new
49 0 ▶{
Subroutine new: not called CC=5 SCAR=34.0
Pod documented
50 0 my ($class, @opts) = @_;
51 0 my ($self);
52
53 0 ▶ $class = ref $class if ref $class;
Branch: 1 branch
BranchTrueFalseTotal
if ref $class 0 0 0
54 0 $self = $class->SUPER::new(@_);
55 0 $self->{' realised'} = 1;
56 0 ▶ if(scalar @opts > 1) {
Branch: 2 branches
BranchTrueFalseTotal
if (scalar @opts > 1) { } 0 0 0
elsif (scalar @opts == 1) { } 0 0 0
57 0 $self->{-isdict}=1;
58 0 my %opt=@opts;
59 0 foreach my $k (sort keys %opt) {
60 0 $self->{$k} = $opt{$k};
61 }
62 } elsif(scalar @opts == 1) {
63 0 $self->{-literal}=$opts[0];
64 }
65 0 return $self;
66 }
67
68 sub outobjdeep
69 0 ▶{
Subroutine outobjdeep: not called CC=9 SCAR=45.0
Pod documented
70 0 my ($self, $fh, $pdf, %opts) = @_;
71 0 ▶ if($self->{-isdict})
Branch: 1 branch
BranchTrueFalseTotal
if ($self->{'-isdict'}) { } 0 0 0
72 {
73 0 ▶ if(defined $self->{' stream'})
Branch: 1 branch
BranchTrueFalseTotal
if (defined $self->{' stream'}) { } 0 0 0
74 {
75 0 $self->{Length} = length($self->{' stream'}) + 1;
76 }
77 else
78 {
79 0 delete $self->{Length};
80 }
81 0 $fh->print("<< ");
82 0 foreach my $k (sort keys %{$self})
83 {
84 0 ▶ next if($k=~m|^[ \-]|o);
Branch: 1 branch
BranchTrueFalseTotal
if $k =~ /^[ \-]/o 0 0 0
85 0 $fh->print('/'.PDF::API3::Compat::API2::Basic::PDF::Name::string_to_name($k).' ');
86 0 ▶ if(ref($self->{$k}) eq 'ARRAY')
Branch: 3 branches
BranchTrueFalseTotal
if (ref $self->{$k} eq 'ARRAY') { } 0 0 0
elsif (ref $self->{$k} eq 'HASH') { } 0 0 0
elsif (UNIVERSAL::can($self->{$k}, 'outobj')) { } 0 0 0
87 {
88 0 $fh->print('['.join(' ',@{$self->{$k}})."]\n");
89 }
90 elsif(ref($self->{$k}) eq 'HASH')
91 {
92 0 $fh->print('<<'.join(' ', map { '/'.PDF::API3::Compat::API2::Basic::PDF::Name::string_to_name($_).' '.$self->{$k}->{$_} } sort keys %{$self->{$k}})." >>\n");
93 }
94 elsif(UNIVERSAL::can($self->{$k},'outobj'))
95 {
96 0 $self->{$k}->outobj($fh, $pdf, %opts);
97 0 $fh->print("\n");
98 }
99 else
100 {
101 0 $fh->print("$self->{$k}\n");
102 }
103 }
104 0 $fh->print(">>\n");
105 0 ▶ if(defined $self->{' stream'})
Branch: 1 branch
BranchTrueFalseTotal
if (defined $self->{" stream"}) 0 0 0
106 {
107 0 $fh->print("stream\n$self->{' stream'}\nendstream"); # next is endobj which has the final cr
108 }
109 }
110 else
111 {
112 0 $fh->print($self->{-literal}); # next is endobj which has the final cr
113 }
114 }
115
116 sub outxmldeep
117 0 ▶{
Subroutine outxmldeep: not called CC=1 SCAR=6.9
Pod undocumented
118 0 my ($self, $fh, $pdf, %opts) = @_;
119 0 $opts{-xmlfh}->print("<Literal>NOT HANDLED HERE.</Literal>\n");
120 }
121
122 sub val
123 0 ▶{ $_[0]; }
Subroutine val: not called CC=1 SCAR=6.9
Pod documented
124
125
126
« API3/Compat/API2/Basic/TTF/Hhea.pm ↑ Summary API3/Compat/API2/Basic/TTF/Prop.pm »