This file is indexed.

/usr/share/perl5/App/Packer/PAR.pm is in libpar-packer-perl 1.012-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
 99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
206
207
208
209
210
211
212
213
214
package App::Packer::PAR;

use strict;
use warnings;
use vars qw($VERSION);
use Config;

$VERSION = '0.91';

sub new {
    my ($type, %args) = @_;

    my $class = ref $type || $type;
    my $self = bless {}, $class;

    # apply default values for frontend/backend
    $args{frontend} ||= 'App::Packer::Frontend::ModuleInfo';
    $args{backend}  ||= 'App::Packer::Backend::DemoPack';

    # automatically require default frontend/backend
    if ($args{frontend} eq 'App::Packer::Frontend::ModuleInfo') {
        require App::Packer::Frontend::ModuleInfo;
    }
    else {
        _require($args{frontend});
    }

    if ($args{backend} eq 'App::Packer::Backend::DemoPack') {
        require App::Packer::Backend::DemoPack;
    }
    else {
        _require($args{backend});
    }

    my $fe = $self->{FRONTEND} =
      ($args{frontend}->can('new')) ? $args{frontend}->new : $args{frontend};

    my $be = $self->{BACKEND} =
      ($args{backend}->can('new')) ? $args{backend}->new : $args{backend};

    $self->_set_args(%args);
    $self->_set_options(%args);

    $be->set_front($fe) if ($be->can('set_front'));

    return $self;
}

sub _set_options {
    my ($self, %args) = @_;

    my $fe = $self->frontend;
    my $be = $self->backend;

    my $frontopts = $args{frontopts} || $args{opts} || undef;
    my $backopts  = $args{backopts}  || $args{opts} || undef;

    $fe->set_options(%$frontopts) if ($fe->can('set_options') and $frontopts);
    $be->set_options(%$backopts)  if ($be->can('set_options') and $backopts);
}

sub _set_args {
    my ($self, %args) = @_;

    my $fe = $self->frontend;
    my $be = $self->backend;

    my $frontargs = $args{frontargs} || $args{args} || undef;
    my $backargs  = $args{backargs}  || $args{args} || undef;

    return if (!$frontargs and !$backargs);

    $fe->set_args(@$frontargs) if ($fe->can('set_args') and $frontargs);
    $be->set_args(@$backargs)  if ($be->can('set_args') and $backargs);
}

sub set_file {
    my $self = shift;
    my $file = shift;

    warn("File not found '$file'"), return unless -f $file;

    $self->backend->set_file($file);

    return 1;
}

sub go {
    my ($self) = @_;

    my $fe = $self->frontend;
    my $be = $self->backend;

    $fe->go if $fe->can('go');
    $be->go if $be->can('go');
}

sub generate_pack {
    my ($self, %opt) = @_;

    my $be = $self->backend;
    $be->generate_pack(%opt);
}

sub run_pack {
    my ($self, %opt) = @_;

    my $be = $self->backend;
    $be->run_pack(%opt);
}

sub add_manifest {
    my ($self) = @_;

    my $be = $self->backend;
    return $be->add_manifest;
}

sub pack_manifest {
    my ($self) = @_;

    my $be = $self->backend;
    return $be->pack_manifest;
}

sub write {
    my $self = shift;
    my $exe  = shift;
    my $ret  = 1;

    # attach exe extension
    $exe .= $Config{_exe} unless $exe =~ m/$Config{_exe}$/i;

    # write file
    $self->frontend->calculate_info;
    my $files = $self->frontend->get_files;
    $ret &= $files ? 1 : 0;
    $ret &= $self->backend->set_files(%$files);
    $ret &= $self->backend->write($exe);

    chmod 0755, $exe if $ret;

    $ret ? return $exe : return;
}

sub set_options {
    my $self = shift;
    my %args = @_;

    if (exists $args{frontend}) {
        $self->frontend->set_options(%{ $args{frontend} });
    }

    if (exists $args{backend}) {
        $self->backend->set_options(%{ $args{backend} });
    }
}

sub add_back_options {
    my ($self, %opt) = @_;
    $self->backend->add_options(%opt);
}

sub add_front_options {
    my ($self, %opt) = @_;
    $self->frontend->add_options(%opt);
}

sub frontend { $_[0]->{FRONTEND} or die "No frontend available" }
sub backend  { $_[0]->{BACKEND}  or die "No backend available" }

sub _require {
    my ($text) = @_;
    $text =~ s{::}{/}g;
    require "$text.pm";
}

1;

__END__

=head1 NAME

App::Packer::PAR - Pack applications in a single executable file

=head1 DESCRIPTION

This module is a modified version of B<App::Packer>, temporarily shipped
with B<PAR> until it is merged into newer versions of B<App::Packer>.

=head1 SEE ALSO

See L<App::Packer> for the programming interface.

=head1 AUTHOR

Code modifications by Edward S. Peschko.  This documentation by Audrey Tang.

Based on the work of Mattia Barbon E<lt>mbarbon@dsi.unive.itE<gt>.

=head1 COPYRIGHT

Copyright 2004-2009 by Edward S. Peschko, Audrey Tang and Mattia Barbon.

This program is free software; you can redistribute it and/or modify it
under the same terms as Perl itself.

See L<http://www.perl.com/perl/misc/Artistic.html>

=cut

# local variables:
# mode: cperl
# end: