/usr/share/perl5/PDF/Create/Outline.pm is in libpdf-create-perl 1.08-1.
This file is owned by root:root, with mode 0o644.
The actual contents of the file can be viewed below.
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 53 54 55 56 57 58 59 60 61 62 63 64 65 66 67 68 69 70 71 72 73 74 75 76 77 78 79 80 81 82 83 84 85 86 87 88 89 90 91 92 93 94 95 96 97 98 | #
# PDF::Create::Outline - PDF outline support for PDF::Create
#
# Author: Fabien Tassin
#
# Copyright 1999-2001 Fabien Tassin
# Copyright 2007- Markus Baertschi <markus@markus.org>
# Copyright 2010 Gary Lieberman
#
# Please see the CHANGES and Changes file for the detailed change log
#
# Please do not use any of the methods here directly. You will be
# punished with your application no longer working after an upgrade !
#
package PDF::Create::Outline;
use strict;
use warnings;
use Carp;
use FileHandle;
use Data::Dumper;
our $VERSION = '1.08';
our $DEBUG = 0;
sub new
{
my $this = shift;
my $class = ref($this) || $this;
my $self = {};
bless $self, $class;
$self->{'Kids'} = [];
$self;
}
sub add
{
my $self = shift;
my $outline = PDF::Create::Outline->new();
$outline->{'id'} = shift;
$outline->{'name'} = shift;
$outline->{'Parent'} = $self;
$outline->{'pdf'} = $self->{'pdf'};
my %params = @_;
$outline->{'Title'} = $params{'Title'} if defined $params{'Title'};
$outline->{'Action'} = $params{'Action'} if defined $params{'Action'};
$outline->{'Status'} = defined $params{'Status'}
&& ( $params{'Status'} eq 'closed' || !$params{'Status'} ) ? 0 : 1;
$outline->{'Dest'} = $params{'Destination'}
if defined $params{'Destination'};
push @{ $self->{'Kids'} }, $outline;
$outline;
}
sub count
{
my $self = shift;
my $c = scalar @{ $self->{'Kids'} };
return $c unless $c;
for my $outline ( @{ $self->{'Kids'} } ) {
my $v = $outline->count;
$c += $v if $outline->{'Status'};
}
$c *= -1 unless $self->{'Status'};
$c;
}
sub kids
{
my $self = shift;
my $t = [];
map { push @$t, $_->{'id'} } @{ $self->{'Kids'} };
$t;
}
sub list
{
my $self = shift;
my @l;
for my $e ( @{ $self->{'Kids'} } ) {
my @t = $e->list;
push @l, $e;
push @l, @t if scalar @t;
}
@l;
}
sub new_outline
{
my $self = shift;
$self->{'pdf'}->new_outline( 'Parent' => $self, @_ );
}
1;
|