| 1 | package Text::PDF::Pages; | ||||||||||||||||||||||||||||||||||||||||||
| 2 | |||||||||||||||||||||||||||||||||||||||||||
| 3 | 1 | ▶ | use strict; | ||||||||||||||||||||||||||||||||||||||||
|
Subroutine
BEGIN: called CC=1 SCAR=0.0
| |||||||||||||||||||||||||||||||||||||||||||
| 4 | 1 | ▶ | use vars qw(@ISA %inst); | ||||||||||||||||||||||||||||||||||||||||
|
Subroutine
BEGIN: called CC=1 SCAR=0.0
| |||||||||||||||||||||||||||||||||||||||||||
| 5 | 1 | @ISA = qw(Text::PDF::Dict); | |||||||||||||||||||||||||||||||||||||||||
| 6 | # no warnings qw(uninitialized); | ||||||||||||||||||||||||||||||||||||||||||
| 7 | |||||||||||||||||||||||||||||||||||||||||||
| 8 | 1 | ▶ | use Text::PDF::Dict; | ||||||||||||||||||||||||||||||||||||||||
|
Subroutine
BEGIN: called CC=1 SCAR=0.0
| |||||||||||||||||||||||||||||||||||||||||||
| 9 | 1 | ▶ | use Text::PDF::Utils; | ||||||||||||||||||||||||||||||||||||||||
|
Subroutine
BEGIN: called CC=1 SCAR=0.0
| |||||||||||||||||||||||||||||||||||||||||||
| 10 | |||||||||||||||||||||||||||||||||||||||||||
| 11 | 1 | %inst = map {$_ => 1} qw(Parent Type); | |||||||||||||||||||||||||||||||||||||||||
| 12 | |||||||||||||||||||||||||||||||||||||||||||
| 13 | =head1 NAME | ||||||||||||||||||||||||||||||||||||||||||
| 14 | |||||||||||||||||||||||||||||||||||||||||||
| 15 | Text::PDF::Pages - a PDF pages hierarchical element. Inherits from L<Text::PDF::Dict> | ||||||||||||||||||||||||||||||||||||||||||
| 16 | |||||||||||||||||||||||||||||||||||||||||||
| 17 | =head1 DESCRIPTION | ||||||||||||||||||||||||||||||||||||||||||
| 18 | |||||||||||||||||||||||||||||||||||||||||||
| 19 | A Pages object is the parent to other pages objects or to page objects | ||||||||||||||||||||||||||||||||||||||||||
| 20 | themselves. | ||||||||||||||||||||||||||||||||||||||||||
| 21 | |||||||||||||||||||||||||||||||||||||||||||
| 22 | =head1 METHODS | ||||||||||||||||||||||||||||||||||||||||||
| 23 | |||||||||||||||||||||||||||||||||||||||||||
| 24 | =head2 Text::PDF::Pages->new($pdfs,$parent) | ||||||||||||||||||||||||||||||||||||||||||
| 25 | |||||||||||||||||||||||||||||||||||||||||||
| 26 | This creates a new Pages object. Notice that $parent here is not the | ||||||||||||||||||||||||||||||||||||||||||
| 27 | file context for the object but the parent pages object for this | ||||||||||||||||||||||||||||||||||||||||||
| 28 | pages. If we are using this class to create a root node, then $parent | ||||||||||||||||||||||||||||||||||||||||||
| 29 | should point to the file context, which is identified by not having a | ||||||||||||||||||||||||||||||||||||||||||
| 30 | Type of Pages. $pdfs is the file object (or objects) in which to | ||||||||||||||||||||||||||||||||||||||||||
| 31 | create the new Pages object. | ||||||||||||||||||||||||||||||||||||||||||
| 32 | |||||||||||||||||||||||||||||||||||||||||||
| 33 | =cut | ||||||||||||||||||||||||||||||||||||||||||
| 34 | |||||||||||||||||||||||||||||||||||||||||||
| 35 | sub new | ||||||||||||||||||||||||||||||||||||||||||
| 36 | { | ||||||||||||||||||||||||||||||||||||||||||
| 37 | 2 | ▶ | my ($class, $pdfs, $parent) = @_; | ||||||||||||||||||||||||||||||||||||||||
|
Subroutine
new: called CC=4 SCAR=13.9
Pod
documented
| |||||||||||||||||||||||||||||||||||||||||||
| 38 | 2 | my ($self); | |||||||||||||||||||||||||||||||||||||||||
| 39 | |||||||||||||||||||||||||||||||||||||||||||
| 40 | 2 | ▶ | $class = ref $class if ref $class; | ||||||||||||||||||||||||||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||||||||||||||||||||||||||
| 41 | 2 | $self = $class->SUPER::new($pdfs, $parent); | |||||||||||||||||||||||||||||||||||||||||
| 42 | 2 | $self->{'Type'} = PDFName("Pages"); | |||||||||||||||||||||||||||||||||||||||||
| 43 | 2 | ▶ | $self->{'Parent'} = $parent if defined $parent; | ||||||||||||||||||||||||||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||||||||||||||||||||||||||
| 44 | 2 | $self->{'Count'} = PDFNum(0); | |||||||||||||||||||||||||||||||||||||||||
| 45 | 2 | $self->{'Kids'} = Text::PDF::Array->new; | |||||||||||||||||||||||||||||||||||||||||
| 46 | 2 | ▶ | $self->{' outto'} = ref $pdfs eq 'ARRAY' ? $pdfs : [$pdfs]; | ||||||||||||||||||||||||||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||||||||||||||||||||||||||
| 47 | 2 | $self->out_obj(1); | |||||||||||||||||||||||||||||||||||||||||
| 48 | |||||||||||||||||||||||||||||||||||||||||||
| 49 | 2 | $self; | |||||||||||||||||||||||||||||||||||||||||
| 50 | } | ||||||||||||||||||||||||||||||||||||||||||
| 51 | |||||||||||||||||||||||||||||||||||||||||||
| 52 | |||||||||||||||||||||||||||||||||||||||||||
| 53 | sub init | ||||||||||||||||||||||||||||||||||||||||||
| 54 | { | ||||||||||||||||||||||||||||||||||||||||||
| 55 | 0 | ▶ | my ($self, $pdf) = @_; | ||||||||||||||||||||||||||||||||||||||||
|
Subroutine
init: not called CC=1 SCAR=6.9
Pod
undocumented
| |||||||||||||||||||||||||||||||||||||||||||
| 56 | 0 | $self->{' outto'} = [$pdf]; | |||||||||||||||||||||||||||||||||||||||||
| 57 | 0 | $self; | |||||||||||||||||||||||||||||||||||||||||
| 58 | } | ||||||||||||||||||||||||||||||||||||||||||
| 59 | |||||||||||||||||||||||||||||||||||||||||||
| 60 | =head2 $p->out_obj($isnew) | ||||||||||||||||||||||||||||||||||||||||||
| 61 | |||||||||||||||||||||||||||||||||||||||||||
| 62 | Tells all the files that this thing is destined for that they should output this | ||||||||||||||||||||||||||||||||||||||||||
| 63 | object come time to output. If this object has no parent, then it must be the | ||||||||||||||||||||||||||||||||||||||||||
| 64 | root. So set as the root for the files in question and tell it to be output too. | ||||||||||||||||||||||||||||||||||||||||||
| 65 | If $isnew is set, then call new_obj rather than out_obj to create as a new | ||||||||||||||||||||||||||||||||||||||||||
| 66 | object in the file. | ||||||||||||||||||||||||||||||||||||||||||
| 67 | |||||||||||||||||||||||||||||||||||||||||||
| 68 | =cut | ||||||||||||||||||||||||||||||||||||||||||
| 69 | |||||||||||||||||||||||||||||||||||||||||||
| 70 | sub out_obj | ||||||||||||||||||||||||||||||||||||||||||
| 71 | { | ||||||||||||||||||||||||||||||||||||||||||
| 72 | 4 | ▶ | my ($self, $isnew) = @_; | ||||||||||||||||||||||||||||||||||||||||
|
Subroutine
out_obj: called CC=4 SCAR=13.9
Pod
documented
| |||||||||||||||||||||||||||||||||||||||||||
| 73 | |||||||||||||||||||||||||||||||||||||||||||
| 74 | 4 | foreach (@{$self->{' outto'}}) | |||||||||||||||||||||||||||||||||||||||||
| 75 | { | ||||||||||||||||||||||||||||||||||||||||||
| 76 | 4 | ▶ | if ($isnew) | ||||||||||||||||||||||||||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||||||||||||||||||||||||||
| 77 | 2 | { $_->new_obj($self); } | |||||||||||||||||||||||||||||||||||||||||
| 78 | else | ||||||||||||||||||||||||||||||||||||||||||
| 79 | 2 | { $_->out_obj($self); } | |||||||||||||||||||||||||||||||||||||||||
| 80 | |||||||||||||||||||||||||||||||||||||||||||
| 81 | 4 | ▶ | unless (defined $self->{'Parent'}) | ||||||||||||||||||||||||||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||||||||||||||||||||||||||
| 82 | { | ||||||||||||||||||||||||||||||||||||||||||
| 83 | 3 | $_->{'Root'}{'Pages'} = $self; | |||||||||||||||||||||||||||||||||||||||||
| 84 | 3 | $_->out_obj($_->{'Root'}); | |||||||||||||||||||||||||||||||||||||||||
| 85 | } | ||||||||||||||||||||||||||||||||||||||||||
| 86 | } | ||||||||||||||||||||||||||||||||||||||||||
| 87 | 4 | $self; | |||||||||||||||||||||||||||||||||||||||||
| 88 | } | ||||||||||||||||||||||||||||||||||||||||||
| 89 | |||||||||||||||||||||||||||||||||||||||||||
| 90 | |||||||||||||||||||||||||||||||||||||||||||
| 91 | =head2 $p->find_page($pnum) | ||||||||||||||||||||||||||||||||||||||||||
| 92 | |||||||||||||||||||||||||||||||||||||||||||
| 93 | Returns the given page, using the page count values in the pages tree. Pages | ||||||||||||||||||||||||||||||||||||||||||
| 94 | start at 0. | ||||||||||||||||||||||||||||||||||||||||||
| 95 | |||||||||||||||||||||||||||||||||||||||||||
| 96 | =cut | ||||||||||||||||||||||||||||||||||||||||||
| 97 | |||||||||||||||||||||||||||||||||||||||||||
| 98 | sub find_page | ||||||||||||||||||||||||||||||||||||||||||
| 99 | { | ||||||||||||||||||||||||||||||||||||||||||
| 100 | 1 | ▶ | my ($self, $pnum) = @_; | ||||||||||||||||||||||||||||||||||||||||
|
Subroutine
find_page: called CC=1 SCAR=0.0
Pod
documented
| |||||||||||||||||||||||||||||||||||||||||||
| 101 | 1 | my ($top) = $self->get_top; | |||||||||||||||||||||||||||||||||||||||||
| 102 | |||||||||||||||||||||||||||||||||||||||||||
| 103 | 1 | $top->find_page_recurse(\$pnum); | |||||||||||||||||||||||||||||||||||||||||
| 104 | } | ||||||||||||||||||||||||||||||||||||||||||
| 105 | |||||||||||||||||||||||||||||||||||||||||||
| 106 | |||||||||||||||||||||||||||||||||||||||||||
| 107 | sub find_page_recurse | ||||||||||||||||||||||||||||||||||||||||||
| 108 | { | ||||||||||||||||||||||||||||||||||||||||||
| 109 | 1 | ▶ | my ($self, $rpnum) = @_; | ||||||||||||||||||||||||||||||||||||||||
|
Subroutine
find_page_recurse: called CC=6 SCAR=28.6
Pod
undocumented
| |||||||||||||||||||||||||||||||||||||||||||
| 110 | 1 | my ($res, $k); | |||||||||||||||||||||||||||||||||||||||||
| 111 | |||||||||||||||||||||||||||||||||||||||||||
| 112 | 1 | ▶ | if ($self->{'Count'}->realise->val <= $$rpnum) | ||||||||||||||||||||||||||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||||||||||||||||||||||||||
| 113 | { | ||||||||||||||||||||||||||||||||||||||||||
| 114 | 0 | $$rpnum -= $self->{'Count'}->val; | |||||||||||||||||||||||||||||||||||||||||
| 115 | 0 | return undef; | |||||||||||||||||||||||||||||||||||||||||
| 116 | } | ||||||||||||||||||||||||||||||||||||||||||
| 117 | |||||||||||||||||||||||||||||||||||||||||||
| 118 | 1 | foreach $k ($self->{'Kids'}->realise->elementsof) | |||||||||||||||||||||||||||||||||||||||||
| 119 | { | ||||||||||||||||||||||||||||||||||||||||||
| 120 | 0 | ▶ | if ($k->{'Type'}->realise->val eq 'Page') | ||||||||||||||||||||||||||||||||||||||||
|
Branch: 2 branches
| |||||||||||||||||||||||||||||||||||||||||||
| 121 | { | ||||||||||||||||||||||||||||||||||||||||||
| 122 | 0 | ▶ | return $k if ($$rpnum == 0); | ||||||||||||||||||||||||||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||||||||||||||||||||||||||
| 123 | 0 | $$rpnum--; | |||||||||||||||||||||||||||||||||||||||||
| 124 | } | ||||||||||||||||||||||||||||||||||||||||||
| 125 | elsif ($res = $k->realise->find_page_recurse($rpnum)) | ||||||||||||||||||||||||||||||||||||||||||
| 126 | 0 | { return $res; } | |||||||||||||||||||||||||||||||||||||||||
| 127 | } | ||||||||||||||||||||||||||||||||||||||||||
| 128 | 1 | return undef; | |||||||||||||||||||||||||||||||||||||||||
| 129 | } | ||||||||||||||||||||||||||||||||||||||||||
| 130 | |||||||||||||||||||||||||||||||||||||||||||
| 131 | =head2 $p->add_page($page, $pnum) | ||||||||||||||||||||||||||||||||||||||||||
| 132 | |||||||||||||||||||||||||||||||||||||||||||
| 133 | Inserts the page before the given $pnum. $pnum can be -ve to count from the END | ||||||||||||||||||||||||||||||||||||||||||
| 134 | of the document. -1 is after the last page. Likewise $pnum can be greater than the | ||||||||||||||||||||||||||||||||||||||||||
| 135 | number of pages currently in the document, to append. | ||||||||||||||||||||||||||||||||||||||||||
| 136 | |||||||||||||||||||||||||||||||||||||||||||
| 137 | This method only guarantees to provide a reasonable pages tree if pages are | ||||||||||||||||||||||||||||||||||||||||||
| 138 | appended or prepended to the document. Pages inserted in the middle of the | ||||||||||||||||||||||||||||||||||||||||||
| 139 | document may simply be inserted in the appropriate leaf in the pages tree without | ||||||||||||||||||||||||||||||||||||||||||
| 140 | adding any new branches or leaves. To tidy up such a mess, it is best to call | ||||||||||||||||||||||||||||||||||||||||||
| 141 | $p->rebuild_tree to rebuild the pages tree into something efficient. | ||||||||||||||||||||||||||||||||||||||||||
| 142 | |||||||||||||||||||||||||||||||||||||||||||
| 143 | =cut | ||||||||||||||||||||||||||||||||||||||||||
| 144 | |||||||||||||||||||||||||||||||||||||||||||
| 145 | sub add_page | ||||||||||||||||||||||||||||||||||||||||||
| 146 | { | ||||||||||||||||||||||||||||||||||||||||||
| 147 | 1 | ▶ | my ($self, $page, $pnum) = @_; | ||||||||||||||||||||||||||||||||||||||||
|
Subroutine
add_page: called CC=11 SCAR=33.0
Pod
documented
| |||||||||||||||||||||||||||||||||||||||||||
| 148 | 1 | my ($top) = $self->get_top; | |||||||||||||||||||||||||||||||||||||||||
| 149 | 1 | my ($ppage, $ppages, $pindex, $ppnum); | |||||||||||||||||||||||||||||||||||||||||
| 150 | |||||||||||||||||||||||||||||||||||||||||||
| 151 | 1 | ▶ | $pnum = -1 unless (defined $pnum && $pnum <= $top->{'Count'}->val); | ||||||||||||||||||||||||||||||||||||||||
|
Branch: 1 branch
Condition33%1/3
defined $pnum and $pnum <= $top->{"Count"}->val
MC/DC0%0/2
defined $pnum and $pnum <= $top->{"Count"}->val
defined $pnum
$pnum <= $top->{"Count"}->val
Truth table33%1/3
A and B
A= defined $pnumB= $pnum <= $top->{"Count"}->val
| |||||||||||||||||||||||||||||||||||||||||||
| 152 | 1 | ▶ | if ($pnum == -1) | ||||||||||||||||||||||||||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||||||||||||||||||||||||||
| 153 | 1 | { $ppage = $top->find_page($top->{'Count'}->val - 1); } | |||||||||||||||||||||||||||||||||||||||||
| 154 | else | ||||||||||||||||||||||||||||||||||||||||||
| 155 | { | ||||||||||||||||||||||||||||||||||||||||||
| 156 | 0 | ▶ | $pnum = $top->{'Count'}->val + $pnum + 1 if ($pnum < 0); | ||||||||||||||||||||||||||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||||||||||||||||||||||||||
| 157 | 0 | $ppage = $top->find_page($pnum); | |||||||||||||||||||||||||||||||||||||||||
| 158 | } | ||||||||||||||||||||||||||||||||||||||||||
| 159 | |||||||||||||||||||||||||||||||||||||||||||
| 160 | 1 | ▶ | if (defined $ppage->{'Parent'}) | ||||||||||||||||||||||||||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||||||||||||||||||||||||||
| 161 | 0 | { $ppages = $ppage->{'Parent'}->realise; } | |||||||||||||||||||||||||||||||||||||||||
| 162 | else | ||||||||||||||||||||||||||||||||||||||||||
| 163 | 1 | { $ppages = $self; } | |||||||||||||||||||||||||||||||||||||||||
| 164 | |||||||||||||||||||||||||||||||||||||||||||
| 165 | 1 | $ppnum = scalar $ppages->{'Kids'}->realise->elementsof; | |||||||||||||||||||||||||||||||||||||||||
| 166 | |||||||||||||||||||||||||||||||||||||||||||
| 167 | 1 | ▶ | if ($pnum == -1) | ||||||||||||||||||||||||||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||||||||||||||||||||||||||
| 168 | 1 | { $pindex = -1; } | |||||||||||||||||||||||||||||||||||||||||
| 169 | else | ||||||||||||||||||||||||||||||||||||||||||
| 170 | { | ||||||||||||||||||||||||||||||||||||||||||
| 171 | 0 | ▶ | for ($pindex = 0; $pindex < $ppnum; $pindex++) | ||||||||||||||||||||||||||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||||||||||||||||||||||||||
| 172 | 0 | ▶ | { last if ($ppages->{'Kids'}{' val'}[$pindex] eq $ppage); } | ||||||||||||||||||||||||||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||||||||||||||||||||||||||
| 173 | 0 | ▶ | $pindex = -1 if ($pindex == $ppnum); | ||||||||||||||||||||||||||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||||||||||||||||||||||||||
| 174 | } | ||||||||||||||||||||||||||||||||||||||||||
| 175 | |||||||||||||||||||||||||||||||||||||||||||
| 176 | 1 | $ppages->add_page_recurse($page->realise, $pindex); | |||||||||||||||||||||||||||||||||||||||||
| 177 | 1 | ▶ | for ($ppages = $page->{'Parent'}; defined $ppages->{'Parent'}; $ppages = $ppages->{'Parent'}->realise) | ||||||||||||||||||||||||||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||||||||||||||||||||||||||
| 178 | 0 | { $ppages->out_obj->{'Count'}->realise->{'val'}++; } | |||||||||||||||||||||||||||||||||||||||||
| 179 | 1 | $ppages->out_obj->{'Count'}->realise->{'val'}++; | |||||||||||||||||||||||||||||||||||||||||
| 180 | 1 | $page; | |||||||||||||||||||||||||||||||||||||||||
| 181 | } | ||||||||||||||||||||||||||||||||||||||||||
| 182 | |||||||||||||||||||||||||||||||||||||||||||
| 183 | |||||||||||||||||||||||||||||||||||||||||||
| 184 | sub add_page_recurse | ||||||||||||||||||||||||||||||||||||||||||
| 185 | { | ||||||||||||||||||||||||||||||||||||||||||
| 186 | 1 | ▶ | my ($self, $page, $index) = @_; | ||||||||||||||||||||||||||||||||||||||||
|
Subroutine
add_page_recurse: called CC=9 SCAR=35.0
Pod
undocumented
| |||||||||||||||||||||||||||||||||||||||||||
| 187 | 1 | my ($newpages, $ppages, $pindex, $ppnum); | |||||||||||||||||||||||||||||||||||||||||
| 188 | |||||||||||||||||||||||||||||||||||||||||||
| 189 | 1 | ▶ | if (scalar $self->{'Kids'}->elementsof >= 8 && $self->{'Parent'} && $index < 1) | ||||||||||||||||||||||||||||||||||||||||
|
Branch: 1 branch
Condition33%2/6
scalar $self->{"Kids"}->elementsof >= 8 and $self->{"Parent"} and $index < 1
scalar $self->{"Kids"}->elementsof >= 8 and $self->{"Parent"}
MC/DC0%0/3
scalar $self->{"Kids"}->elementsof >= 8 and $self->{"Parent"} and $index < 1
scalar $self->{"Kids"}->elementsof >= 8
$self->{"Parent"}
$index < 1
Truth table25%1/4
A and B and C
A= scalar $self->{"Kids"}->elementsof >= 8B= $self->{"Parent"}C= $index < 1
| |||||||||||||||||||||||||||||||||||||||||||
| 190 | { | ||||||||||||||||||||||||||||||||||||||||||
| 191 | 0 | $ppages = $self->{'Parent'}->realise; | |||||||||||||||||||||||||||||||||||||||||
| 192 | 0 | $newpages = $self->new($self->{' outto'}, $ppages); | |||||||||||||||||||||||||||||||||||||||||
| 193 | 0 | ▶ | if ($ppages) | ||||||||||||||||||||||||||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||||||||||||||||||||||||||
| 194 | { | ||||||||||||||||||||||||||||||||||||||||||
| 195 | 0 | $ppnum = scalar $ppages->{'Kids'}->realise->elementsof; | |||||||||||||||||||||||||||||||||||||||||
| 196 | 0 | ▶ | for ($pindex = 0; $pindex < $ppnum; $pindex++) | ||||||||||||||||||||||||||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||||||||||||||||||||||||||
| 197 | 0 | ▶ | { last if ($ppages->{'Kids'}{' val'}[$pindex] eq $self); } | ||||||||||||||||||||||||||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||||||||||||||||||||||||||
| 198 | 0 | ▶ | $pindex = -1 if ($pindex == $ppnum); | ||||||||||||||||||||||||||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||||||||||||||||||||||||||
| 199 | 0 | $ppages->add_page_recurse($newpages, $pindex); | |||||||||||||||||||||||||||||||||||||||||
| 200 | } | ||||||||||||||||||||||||||||||||||||||||||
| 201 | } | ||||||||||||||||||||||||||||||||||||||||||
| 202 | else | ||||||||||||||||||||||||||||||||||||||||||
| 203 | 1 | { $newpages = $self->out_obj; } | |||||||||||||||||||||||||||||||||||||||||
| 204 | |||||||||||||||||||||||||||||||||||||||||||
| 205 | 1 | ▶ | if ($index < 0) | ||||||||||||||||||||||||||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||||||||||||||||||||||||||
| 206 | 1 | { push (@{$newpages->{'Kids'}->realise->{' val'}}, $page); } | |||||||||||||||||||||||||||||||||||||||||
| 207 | else | ||||||||||||||||||||||||||||||||||||||||||
| 208 | 0 | { splice (@{$newpages->{'Kids'}{' val'}}, $index, 0, $page); } | |||||||||||||||||||||||||||||||||||||||||
| 209 | 1 | $page->{'Parent'} = $newpages; | |||||||||||||||||||||||||||||||||||||||||
| 210 | } | ||||||||||||||||||||||||||||||||||||||||||
| 211 | |||||||||||||||||||||||||||||||||||||||||||
| 212 | |||||||||||||||||||||||||||||||||||||||||||
| 213 | =head2 $root_pages = $p->rebuild_tree([@pglist]) | ||||||||||||||||||||||||||||||||||||||||||
| 214 | |||||||||||||||||||||||||||||||||||||||||||
| 215 | Rebuilds the pages tree to make a nice balanced tree that conforms to Adobe | ||||||||||||||||||||||||||||||||||||||||||
| 216 | recommendations. If passed a pglist then the tree is built for that list of | ||||||||||||||||||||||||||||||||||||||||||
| 217 | pages. No check is made of whether the pglist contains pages. | ||||||||||||||||||||||||||||||||||||||||||
| 218 | |||||||||||||||||||||||||||||||||||||||||||
| 219 | Returns the top of the tree for insertion in the root object. | ||||||||||||||||||||||||||||||||||||||||||
| 220 | |||||||||||||||||||||||||||||||||||||||||||
| 221 | =cut | ||||||||||||||||||||||||||||||||||||||||||
| 222 | |||||||||||||||||||||||||||||||||||||||||||
| 223 | sub rebuild_tree | ||||||||||||||||||||||||||||||||||||||||||
| 224 | { | ||||||||||||||||||||||||||||||||||||||||||
| 225 | 0 | ▶ | my ($self, @pglist) = @_; | ||||||||||||||||||||||||||||||||||||||||
|
Subroutine
rebuild_tree: not called CC=1 SCAR=6.9
Pod
documented
| |||||||||||||||||||||||||||||||||||||||||||
| 226 | } | ||||||||||||||||||||||||||||||||||||||||||
| 227 | |||||||||||||||||||||||||||||||||||||||||||
| 228 | |||||||||||||||||||||||||||||||||||||||||||
| 229 | =head2 @pglist = $p->get_pages | ||||||||||||||||||||||||||||||||||||||||||
| 230 | |||||||||||||||||||||||||||||||||||||||||||
| 231 | Returns a list of page objects in the document in page order | ||||||||||||||||||||||||||||||||||||||||||
| 232 | |||||||||||||||||||||||||||||||||||||||||||
| 233 | =cut | ||||||||||||||||||||||||||||||||||||||||||
| 234 | |||||||||||||||||||||||||||||||||||||||||||
| 235 | sub get_pages | ||||||||||||||||||||||||||||||||||||||||||
| 236 | { | ||||||||||||||||||||||||||||||||||||||||||
| 237 | 0 | ▶ | my ($self) = @_; | ||||||||||||||||||||||||||||||||||||||||
|
Subroutine
get_pages: not called CC=1 SCAR=6.9
Pod
documented
| |||||||||||||||||||||||||||||||||||||||||||
| 238 | |||||||||||||||||||||||||||||||||||||||||||
| 239 | 0 | return $self->get_top->get_kids; | |||||||||||||||||||||||||||||||||||||||||
| 240 | } | ||||||||||||||||||||||||||||||||||||||||||
| 241 | |||||||||||||||||||||||||||||||||||||||||||
| 242 | |||||||||||||||||||||||||||||||||||||||||||
| 243 | # only call this on the top level or anything you want pages below | ||||||||||||||||||||||||||||||||||||||||||
| 244 | sub get_kids | ||||||||||||||||||||||||||||||||||||||||||
| 245 | { | ||||||||||||||||||||||||||||||||||||||||||
| 246 | 0 | ▶ | my ($self) = @_; | ||||||||||||||||||||||||||||||||||||||||
|
Subroutine
get_kids: not called CC=3 SCAR=24.8
Pod
undocumented
| |||||||||||||||||||||||||||||||||||||||||||
| 247 | 0 | my ($pgref, @pglist); | |||||||||||||||||||||||||||||||||||||||||
| 248 | |||||||||||||||||||||||||||||||||||||||||||
| 249 | 0 | foreach $pgref ($self->{'Kids'}->elementsof) | |||||||||||||||||||||||||||||||||||||||||
| 250 | { | ||||||||||||||||||||||||||||||||||||||||||
| 251 | 0 | $pgref->realise; | |||||||||||||||||||||||||||||||||||||||||
| 252 | 0 | ▶ | if ($pgref->{'Type'}->val =~ m/^Pages$/oi) | ||||||||||||||||||||||||||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||||||||||||||||||||||||||
| 253 | 0 | { push (@pglist, $pgref->get_kids()); } | |||||||||||||||||||||||||||||||||||||||||
| 254 | else | ||||||||||||||||||||||||||||||||||||||||||
| 255 | 0 | { push (@pglist, $pgref); } | |||||||||||||||||||||||||||||||||||||||||
| 256 | } | ||||||||||||||||||||||||||||||||||||||||||
| 257 | 0 | @pglist; | |||||||||||||||||||||||||||||||||||||||||
| 258 | } | ||||||||||||||||||||||||||||||||||||||||||
| 259 | |||||||||||||||||||||||||||||||||||||||||||
| 260 | =head2 $p->find_prop($key) | ||||||||||||||||||||||||||||||||||||||||||
| 261 | |||||||||||||||||||||||||||||||||||||||||||
| 262 | Searches up through the inheritance tree to find a property. | ||||||||||||||||||||||||||||||||||||||||||
| 263 | |||||||||||||||||||||||||||||||||||||||||||
| 264 | =cut | ||||||||||||||||||||||||||||||||||||||||||
| 265 | |||||||||||||||||||||||||||||||||||||||||||
| 266 | sub find_prop | ||||||||||||||||||||||||||||||||||||||||||
| 267 | { | ||||||||||||||||||||||||||||||||||||||||||
| 268 | 3 | ▶ | my ($self, $prop) = @_; | ||||||||||||||||||||||||||||||||||||||||
|
Subroutine
find_prop: called CC=5 SCAR=18.9
Pod
documented
| |||||||||||||||||||||||||||||||||||||||||||
| 269 | |||||||||||||||||||||||||||||||||||||||||||
| 270 | 3 | ▶ | if (defined $self->{$prop}) | ||||||||||||||||||||||||||||||||||||||||
|
Branch: 2 branches
| |||||||||||||||||||||||||||||||||||||||||||
| 271 | { | ||||||||||||||||||||||||||||||||||||||||||
| 272 | 1 | ▶ | if (ref $self->{$prop} && $self->{$prop}->isa("Text::PDF::Objind")) | ||||||||||||||||||||||||||||||||||||||||
|
Branch: 1 branch
Condition33%1/3
ref $self->{$prop} and $self->{$prop}->isa("Text::PDF::Objind")
MC/DC0%0/2
ref $self->{$prop} and $self->{$prop}->isa("Text::PDF::Objind")
ref $self->{$prop}
$self->{$prop}->isa("Text::PDF::Objind")
Truth table33%1/3
A and B
A= ref $self->{$prop}B= $self->{$prop}->isa("Text::PDF::Objind")
| |||||||||||||||||||||||||||||||||||||||||||
| 273 | 1 | { return $self->{$prop}->realise; } | |||||||||||||||||||||||||||||||||||||||||
| 274 | else | ||||||||||||||||||||||||||||||||||||||||||
| 275 | 0 | { return $self->{$prop}; } | |||||||||||||||||||||||||||||||||||||||||
| 276 | } elsif (defined $self->{'Parent'}) | ||||||||||||||||||||||||||||||||||||||||||
| 277 | 0 | { return $self->{'Parent'}->find_prop($prop); } | |||||||||||||||||||||||||||||||||||||||||
| 278 | } | ||||||||||||||||||||||||||||||||||||||||||
| 279 | |||||||||||||||||||||||||||||||||||||||||||
| 280 | # defined $_[0]->{$_[1]} && $_[0]->{$_[1]}->realised or | ||||||||||||||||||||||||||||||||||||||||||
| 281 | # defined $_[0]->{'Parent'} && $_[0]->{'Parent'}->find_prop($_[1]); } | ||||||||||||||||||||||||||||||||||||||||||
| 282 | |||||||||||||||||||||||||||||||||||||||||||
| 283 | |||||||||||||||||||||||||||||||||||||||||||
| 284 | =head2 $p->add_font($pdf, $font) | ||||||||||||||||||||||||||||||||||||||||||
| 285 | |||||||||||||||||||||||||||||||||||||||||||
| 286 | Creates or edits the resource dictionary at this level in the hierarchy. If | ||||||||||||||||||||||||||||||||||||||||||
| 287 | the font is already supported even through the hierarchy, then it is not added. | ||||||||||||||||||||||||||||||||||||||||||
| 288 | |||||||||||||||||||||||||||||||||||||||||||
| 289 | =cut | ||||||||||||||||||||||||||||||||||||||||||
| 290 | |||||||||||||||||||||||||||||||||||||||||||
| 291 | sub add_font | ||||||||||||||||||||||||||||||||||||||||||
| 292 | { | ||||||||||||||||||||||||||||||||||||||||||
| 293 | 1 | ▶ | my ($self, $font, $pdf) = @_; | ||||||||||||||||||||||||||||||||||||||||
|
Subroutine
add_font: called CC=12 SCAR=32.8
Pod
documented
| |||||||||||||||||||||||||||||||||||||||||||
| 294 | 1 | my ($name) = $font->{'Name'}->val; | |||||||||||||||||||||||||||||||||||||||||
| 295 | 1 | my ($dict) = $self->find_prop('Resources'); | |||||||||||||||||||||||||||||||||||||||||
| 296 | 1 | my ($rdict); | |||||||||||||||||||||||||||||||||||||||||
| 297 | |||||||||||||||||||||||||||||||||||||||||||
| 298 | 1 | ▶ | return $self if ($dict ne "" && defined $dict->{'Font'} && defined $dict->{'Font'}{$name}); | ||||||||||||||||||||||||||||||||||||||||
|
Branch: 1 branch
Condition33%2/6
$dict ne "" and defined $dict->{"Font"} and defined $dict->{"Font"}{$name}
$dict ne "" and defined $dict->{"Font"}
MC/DC0%0/3
$dict ne "" and defined $dict->{"Font"} and defined $dict->{"Font"}{$name}
$dict ne ""
defined $dict->{"Font"}
defined $dict->{"Font"}{$name}
Truth table25%1/4
A and B and C
A= $dict ne ""B= defined $dict->{"Font"}C= defined $dict->{"Font"}{$name}
| |||||||||||||||||||||||||||||||||||||||||||
| 299 | 1 | ▶ | unless (defined $self->{'Resources'}) | ||||||||||||||||||||||||||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||||||||||||||||||||||||||
| 300 | { | ||||||||||||||||||||||||||||||||||||||||||
| 301 | 0 | ▶ | $dict = $dict ne "" ? $dict->copy($pdf) : PDFDict(); | ||||||||||||||||||||||||||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||||||||||||||||||||||||||
| 302 | 0 | $self->{'Resources'} = $dict; | |||||||||||||||||||||||||||||||||||||||||
| 303 | } | ||||||||||||||||||||||||||||||||||||||||||
| 304 | else | ||||||||||||||||||||||||||||||||||||||||||
| 305 | 1 | { $dict = $self->{'Resources'}; } | |||||||||||||||||||||||||||||||||||||||||
| 306 | 1 | ▶ | $dict->{'Font'} = PDFDict() unless defined $self->{'Resources'}{'Font'}; | ||||||||||||||||||||||||||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||||||||||||||||||||||||||
| 307 | 1 | $rdict = $dict->{'Font'}->val; | |||||||||||||||||||||||||||||||||||||||||
| 308 | 1 | ▶ | $rdict->{$name} = $font unless ($rdict->{$name}); | ||||||||||||||||||||||||||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||||||||||||||||||||||||||
| 309 | 1 | ▶ | if (ref $dict ne 'HASH' && $dict->is_obj($pdf)) | ||||||||||||||||||||||||||||||||||||||||
|
Branch: 1 branch
Condition33%1/3
ref $dict ne "HASH" and $dict->is_obj($pdf)
MC/DC0%0/2
ref $dict ne "HASH" and $dict->is_obj($pdf)
ref $dict ne "HASH"
$dict->is_obj($pdf)
Truth table33%1/3
A and B
A= ref $dict ne "HASH"B= $dict->is_obj($pdf)
| |||||||||||||||||||||||||||||||||||||||||||
| 310 | 0 | { $pdf->out_obj($dict); } | |||||||||||||||||||||||||||||||||||||||||
| 311 | 1 | ▶ | if (ref $rdict ne 'HASH' && $rdict->is_obj($pdf)) | ||||||||||||||||||||||||||||||||||||||||
|
Branch: 1 branch
Condition33%1/3
ref $rdict ne "HASH" and $rdict->is_obj($pdf)
MC/DC0%0/2
ref $rdict ne "HASH" and $rdict->is_obj($pdf)
ref $rdict ne "HASH"
$rdict->is_obj($pdf)
Truth table33%1/3
A and B
A= ref $rdict ne "HASH"B= $rdict->is_obj($pdf)
| |||||||||||||||||||||||||||||||||||||||||||
| 312 | 0 | { $pdf->out_obj($rdict); } | |||||||||||||||||||||||||||||||||||||||||
| 313 | 1 | $self; | |||||||||||||||||||||||||||||||||||||||||
| 314 | } | ||||||||||||||||||||||||||||||||||||||||||
| 315 | |||||||||||||||||||||||||||||||||||||||||||
| 316 | |||||||||||||||||||||||||||||||||||||||||||
| 317 | =head2 $p->bbox($xmin, $ymin, $xmax, $ymax, [$param]) | ||||||||||||||||||||||||||||||||||||||||||
| 318 | |||||||||||||||||||||||||||||||||||||||||||
| 319 | Specifies the bounding box for this and all child pages. If the values are | ||||||||||||||||||||||||||||||||||||||||||
| 320 | identical to those inherited then no change is made. $param specifies the attribute | ||||||||||||||||||||||||||||||||||||||||||
| 321 | name so that other 'bounding box'es can be set with this method. | ||||||||||||||||||||||||||||||||||||||||||
| 322 | |||||||||||||||||||||||||||||||||||||||||||
| 323 | =cut | ||||||||||||||||||||||||||||||||||||||||||
| 324 | |||||||||||||||||||||||||||||||||||||||||||
| 325 | sub bbox | ||||||||||||||||||||||||||||||||||||||||||
| 326 | { | ||||||||||||||||||||||||||||||||||||||||||
| 327 | 1 | ▶ | my ($self, @bbox) = @_; | ||||||||||||||||||||||||||||||||||||||||
|
Subroutine
bbox: called CC=8 SCAR=29.4
Pod
documented
| |||||||||||||||||||||||||||||||||||||||||||
| 328 | 1 | ▶ | my ($str) = $bbox[4] || 'MediaBox'; | ||||||||||||||||||||||||||||||||||||||||
|
Condition50%1/2
$bbox[4] || 'MediaBox'
MC/DC0%0/1
$bbox[4] || 'MediaBox'
$bbox[4]
Truth table50%1/2
A
A= $bbox[4]
| |||||||||||||||||||||||||||||||||||||||||||
| 329 | 1 | my ($inh) = $self->find_prop($str); | |||||||||||||||||||||||||||||||||||||||||
| 330 | 1 | my ($test, $i, $e); | |||||||||||||||||||||||||||||||||||||||||
| 331 | |||||||||||||||||||||||||||||||||||||||||||
| 332 | 1 | ▶ | if ($inh ne "") | ||||||||||||||||||||||||||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||||||||||||||||||||||||||
| 333 | { | ||||||||||||||||||||||||||||||||||||||||||
| 334 | 0 | $test = 1; $i = 0; | |||||||||||||||||||||||||||||||||||||||||
| 335 | 0 | foreach $e ($inh->elementsof) | |||||||||||||||||||||||||||||||||||||||||
| 336 | 0 | ▶ | { $test &&= $e->val == $bbox[$i++]; } | ||||||||||||||||||||||||||||||||||||||||
|
Condition0%0/3
$test &&= $e->val == $bbox[$i++]
MC/DC0%0/2
$test &&= $e->val == $bbox[$i++]
$test
$e->val == $bbox[$i++]
Truth table0%0/3
A &&= B
A= $testB= $e->val == $bbox[$i++]
| |||||||||||||||||||||||||||||||||||||||||||
| 337 | 0 | ▶ | return $self if $test && $i == 4; | ||||||||||||||||||||||||||||||||||||||||
|
Branch: 1 branch
Condition0%0/3
$test and $i == 4
MC/DC0%0/2
$test and $i == 4
$test
$i == 4
Truth table0%0/3
A and B
A= $testB= $i == 4
| |||||||||||||||||||||||||||||||||||||||||||
| 338 | } | ||||||||||||||||||||||||||||||||||||||||||
| 339 | |||||||||||||||||||||||||||||||||||||||||||
| 340 | 1 | $inh = Text::PDF::Array->new; | |||||||||||||||||||||||||||||||||||||||||
| 341 | 1 | foreach $e (@bbox[0..3]) | |||||||||||||||||||||||||||||||||||||||||
| 342 | 4 | { $inh->add_elements(PDFNum($e)); } | |||||||||||||||||||||||||||||||||||||||||
| 343 | 1 | $self->{$str} = $inh; | |||||||||||||||||||||||||||||||||||||||||
| 344 | 1 | $self; | |||||||||||||||||||||||||||||||||||||||||
| 345 | } | ||||||||||||||||||||||||||||||||||||||||||
| 346 | |||||||||||||||||||||||||||||||||||||||||||
| 347 | |||||||||||||||||||||||||||||||||||||||||||
| 348 | =head2 $p->proc_set(@entries) | ||||||||||||||||||||||||||||||||||||||||||
| 349 | |||||||||||||||||||||||||||||||||||||||||||
| 350 | Ensures that the current resource contains all the entries in the proc_sets | ||||||||||||||||||||||||||||||||||||||||||
| 351 | listed. If necessary it creates a local resource dictionary to achieve this. | ||||||||||||||||||||||||||||||||||||||||||
| 352 | |||||||||||||||||||||||||||||||||||||||||||
| 353 | =cut | ||||||||||||||||||||||||||||||||||||||||||
| 354 | |||||||||||||||||||||||||||||||||||||||||||
| 355 | sub proc_set | ||||||||||||||||||||||||||||||||||||||||||
| 356 | { | ||||||||||||||||||||||||||||||||||||||||||
| 357 | 1 | ▶ | my ($self, @entries) = @_; | ||||||||||||||||||||||||||||||||||||||||
|
Subroutine
proc_set: called CC=10 SCAR=30.0
Pod
documented
| |||||||||||||||||||||||||||||||||||||||||||
| 358 | 1 | my (@temp) = @entries; | |||||||||||||||||||||||||||||||||||||||||
| 359 | 1 | my ($dict, $e); | |||||||||||||||||||||||||||||||||||||||||
| 360 | |||||||||||||||||||||||||||||||||||||||||||
| 361 | 1 | $dict = $self->find_prop('Resource'); | |||||||||||||||||||||||||||||||||||||||||
| 362 | 1 | ▶ | if ($dict ne "" && defined $dict->{'ProcSet'}) | ||||||||||||||||||||||||||||||||||||||||
|
Branch: 1 branch
Condition33%1/3
$dict ne "" and defined $dict->{"ProcSet"}
MC/DC0%0/2
$dict ne "" and defined $dict->{"ProcSet"}
$dict ne ""
defined $dict->{"ProcSet"}
Truth table33%1/3
A and B
A= $dict ne ""B= defined $dict->{"ProcSet"}
| |||||||||||||||||||||||||||||||||||||||||||
| 363 | { | ||||||||||||||||||||||||||||||||||||||||||
| 364 | 0 | foreach $e ($dict->{'ProcSet'}->elementsof) | |||||||||||||||||||||||||||||||||||||||||
| 365 | 0 | { @temp = grep($_ ne $e, @temp); } | |||||||||||||||||||||||||||||||||||||||||
| 366 | 0 | ▶ | return $self if (scalar @temp == 0); | ||||||||||||||||||||||||||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||||||||||||||||||||||||||
| 367 | 0 | ▶ | @entries = @temp if defined $self->{'Resources'}; | ||||||||||||||||||||||||||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||||||||||||||||||||||||||
| 368 | } | ||||||||||||||||||||||||||||||||||||||||||
| 369 | |||||||||||||||||||||||||||||||||||||||||||
| 370 | 1 | ▶ | unless (defined $self->{'Resources'}) | ||||||||||||||||||||||||||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||||||||||||||||||||||||||
| 371 | 1 | ▶ | { $self->{'Resources'} = $dict ne "" ? $dict->copy : PDFDict(); } | ||||||||||||||||||||||||||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||||||||||||||||||||||||||
| 372 | |||||||||||||||||||||||||||||||||||||||||||
| 373 | 1 | ▶ | $self->{'Resources'}{'ProcSet'} = PDFArray() unless defined $self->{'ProcSet'}; | ||||||||||||||||||||||||||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||||||||||||||||||||||||||
| 374 | |||||||||||||||||||||||||||||||||||||||||||
| 375 | 1 | foreach $e (@entries) | |||||||||||||||||||||||||||||||||||||||||
| 376 | 2 | { $self->{'Resources'}{'ProcSet'}->add_elements(PDFName($e)); } | |||||||||||||||||||||||||||||||||||||||||
| 377 | 1 | $self; | |||||||||||||||||||||||||||||||||||||||||
| 378 | } | ||||||||||||||||||||||||||||||||||||||||||
| 379 | |||||||||||||||||||||||||||||||||||||||||||
| 380 | sub empty | ||||||||||||||||||||||||||||||||||||||||||
| 381 | { | ||||||||||||||||||||||||||||||||||||||||||
| 382 | 0 | ▶ | my ($self) = @_; | ||||||||||||||||||||||||||||||||||||||||
|
Subroutine
empty: not called CC=3 SCAR=24.8
Pod
documented
| |||||||||||||||||||||||||||||||||||||||||||
| 383 | 0 | ▶ | my ($parent) = $self->{'Parent'} if defined ($self->{'Parent'}); | ||||||||||||||||||||||||||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||||||||||||||||||||||||||
| 384 | |||||||||||||||||||||||||||||||||||||||||||
| 385 | 0 | $self->SUPER::empty; | |||||||||||||||||||||||||||||||||||||||||
| 386 | 0 | ▶ | $self->{'Parent'} = $parent if defined $parent; | ||||||||||||||||||||||||||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||||||||||||||||||||||||||
| 387 | 0 | $self; | |||||||||||||||||||||||||||||||||||||||||
| 388 | } | ||||||||||||||||||||||||||||||||||||||||||
| 389 | |||||||||||||||||||||||||||||||||||||||||||
| 390 | sub dont_copy | ||||||||||||||||||||||||||||||||||||||||||
| 391 | 0 | ▶ | { return $inst{$_[1]} || $_[0]->SUPER::dont_copy($_[1]); } | ||||||||||||||||||||||||||||||||||||||||
|
Subroutine
dont_copy: not called CC=2 SCAR=17.9
Pod
undocumented
Condition0%0/3
$Text::PDF::Pages::inst{$_[1]} || $_[0]->SUPER::dont_copy($_[1])
MC/DC0%0/2
$Text::PDF::Pages::inst{$_[1]} || $_[0]->SUPER::dont_copy($_[1])
$Text::PDF::Pages::inst{$_[1]}
$_[0]->SUPER::dont_copy($_[1])
Truth table0%0/3
A || B
A= $Text::PDF::Pages::inst{$_[1]}B= $_[0]->SUPER::dont_copy($_[1])
| |||||||||||||||||||||||||||||||||||||||||||
| 392 | |||||||||||||||||||||||||||||||||||||||||||
| 393 | |||||||||||||||||||||||||||||||||||||||||||
| 394 | =head2 $p->get_top | ||||||||||||||||||||||||||||||||||||||||||
| 395 | |||||||||||||||||||||||||||||||||||||||||||
| 396 | Returns the top of the pages tree | ||||||||||||||||||||||||||||||||||||||||||
| 397 | |||||||||||||||||||||||||||||||||||||||||||
| 398 | =cut | ||||||||||||||||||||||||||||||||||||||||||
| 399 | |||||||||||||||||||||||||||||||||||||||||||
| 400 | sub get_top | ||||||||||||||||||||||||||||||||||||||||||
| 401 | { | ||||||||||||||||||||||||||||||||||||||||||
| 402 | 2 | ▶ | my ($self) = @_; | ||||||||||||||||||||||||||||||||||||||||
|
Subroutine
get_top: called CC=2 SCAR=7.0
Pod
documented
| |||||||||||||||||||||||||||||||||||||||||||
| 403 | 2 | my ($p); | |||||||||||||||||||||||||||||||||||||||||
| 404 | |||||||||||||||||||||||||||||||||||||||||||
| 405 | 2 | ▶ | for ($p = $self; defined $p->{'Parent'}; $p = $p->{'Parent'}) | ||||||||||||||||||||||||||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||||||||||||||||||||||||||
| 406 | { } | ||||||||||||||||||||||||||||||||||||||||||
| 407 | |||||||||||||||||||||||||||||||||||||||||||
| 408 | 2 | $p->realise; | |||||||||||||||||||||||||||||||||||||||||
| 409 | } | ||||||||||||||||||||||||||||||||||||||||||
| 410 | |||||||||||||||||||||||||||||||||||||||||||
| 411 | |||||||||||||||||||||||||||||||||||||||||||
| 412 | 1 | 1; | |||||||||||||||||||||||||||||||||||||||||