This file is indexed.

/usr/share/perl5/Archive/Any.pm is in libarchive-any-perl 0.0942-2.

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
215
216
217
218
219
220
221
222
223
224
225
226
227
228
229
230
231
232
233
234
235
236
237
238
239
240
241
242
243
244
245
246
247
248
249
250
251
252
253
254
255
256
package Archive::Any;
$Archive::Any::VERSION = '0.0942';
use strict;
use warnings;

use Archive::Any::Plugin;
use File::Spec::Functions qw( rel2abs splitdir );
use File::MMagic;
use MIME::Types qw(by_suffix);

sub new {
    my ( $class, $file, $type ) = @_;

    $file = rel2abs( $file );
    return unless -f $file;

    my %available;

    my @plugins = Archive::Any::Plugin->findsubmod;
    foreach my $plugin ( @plugins ) {
        eval "require $plugin";
        next if $@;

        my @types = $plugin->can_handle();
        foreach my $type ( @types ) {
            next if exists( $available{$type} );
            $available{$type} = $plugin;
        }
    }

    my $mime_type;

    if ( $type ) {

        # The user forced the type.
        ( $mime_type ) = by_suffix( $type );
        unless ( $mime_type ) {
            warn "No mime type found for type '$type'";
            return;
        }
    }
    else {
        # Autodetect the type.
        $mime_type = File::MMagic->new()->checktype_filename( $file );
    }

    my $handler = $available{$mime_type};
    if ( !$handler ) {
        warn "No handler available for type '$mime_type'";
        return;
    }

    return bless {
        file    => $file,
        handler => $handler,
        type    => $mime_type,
    }, $class;
}

sub extract {
    my $self = shift;
    my $dir  = shift;

    return defined( $dir )
        ? $self->{handler}->_extract( $self->{file}, $dir )
        : $self->{handler}->_extract( $self->{file} );
}

sub files {
    my $self = shift;
    return $self->{handler}->files( $self->{file} );
}

sub is_impolite {
    my $self = shift;

    my @files         = $self->files;
    my $first_file    = $files[0];
    my ( $first_dir ) = splitdir( $first_file );

    return grep( !/^\Q$first_dir\E/, @files ) ? 1 : 0;
}

sub is_naughty {
    my ( $self ) = shift;
    return ( grep {m{^(?:/|(?:\./)*\.\./)}} $self->files ) ? 1 : 0;
}

sub mime_type {
    my $self = shift;
    return $self->{type};
}

#
# This is not really here.  You are not seeing this.
#
sub type {
    my $self = shift;
    return $self->{handler}->type();
}

# End of what you are not seeing.

1;

# ABSTRACT: Single interface to deal with file archives.

__END__

=pod

=encoding UTF-8

=head1 NAME

Archive::Any - Single interface to deal with file archives.

=head1 VERSION

version 0.0942

=head1 SYNOPSIS

    use Archive::Any;

    my $archive = Archive::Any->new( $archive_file );

    my @files = $archive->files;

    $archive->extract;

    my $type = $archive->type;

    $archive->is_impolite;
    $archive->is_naughty;

=head1 DESCRIPTION

This module is a single interface for manipulating different archive formats.
Tarballs, zip files, etc.

=over 4

=item B<new>

    my $archive = Archive::Any->new( $archive_file );
    my $archive = Archive::Any->new( $archive_file, $type );

$type is optional.  It lets you force the file type in case Archive::Any can't
figure it out.

=item B<extract>

    $archive->extract;
    $archive->extract( $directory );

Extracts the files in the archive to the given $directory.  If no $directory is
given, it will go into the current working directory.

=item B<files>

    my @file = $archive->files;

A list of files in the archive.

=item B<mime_type>

    my $mime_type = $archive->mime_type();

Returns the mime type of the archive.

=item B<is_impolite>

    my $is_impolite = $archive->is_impolite;

Checks to see if this archive is going to unpack into the current directory
rather than create its own.

=item B<is_naughty>

    my $is_naughty = $archive->is_naughty;

Checks to see if this archive is going to unpack B<outside> the current
directory.

=back

=head1 DEPRECATED

=over 4

=item B<type>

    my $type = $archive->type;

Returns the type of archive.  This method is provided for backwards
compatibility in the Tar and Zip plugins and will be going away B<soon> in
favor of C<mime_type>.

=back

=head1 PLUGINS

For detailed information on writing plugins to work with Archive::Any, please
see the pod documentation for L<Archive::Any::Plugin>.

=head1 SEE ALSO

Archive::Any::Plugin

=head1 SUPPORT

You can find documentation for this module with the perldoc command.

    perldoc Archive::Any

You can also look for information at:

=over 4

=item * MetaCPAN

L<https://metacpan.org/module/Archive::Any>

=item * Issue tracker

L<https://github.com/oalders/archive-any/issues>

=back

=head1 AUTHORS

=over 4

=item *

Clint Moore

=item *

Michael G Schwern (author emeritus)

=item *

Olaf Alders (current maintainer)

=back

=head1 COPYRIGHT AND LICENSE

This software is copyright (c) 2015 by Olaf Alders.

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

=cut