/usr/share/perl5/Dist/Metadata/Zip.pm is in libdist-metadata-perl 0.927-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 | # vim: set ts=2 sts=2 sw=2 expandtab smarttab:
#
# This file is part of Dist-Metadata
#
# This software is copyright (c) 2011 by Randy Stauner.
#
# This is free software; you can redistribute it and/or modify it under
# the same terms as the Perl 5 programming language system itself.
#
use strict;
use warnings;
package Dist::Metadata::Zip;
our $AUTHORITY = 'cpan:RWSTAUNER';
# ABSTRACT: Enable Dist::Metadata for zip files
$Dist::Metadata::Zip::VERSION = '0.927';
use Archive::Zip 1.30 ();
use Carp (); # core
use parent 'Dist::Metadata::Archive';
push(@Dist::Metadata::CARP_NOT, __PACKAGE__);
sub file_content {
my ($self, $file) = @_;
my ($content, $status) = $self->archive->contents( $self->full_path($file) );
Carp::croak "Failed to get content of '$file' from archive"
if $status != Archive::Zip::AZ_OK();
return $content;
}
sub find_files {
my ($self) = @_;
return
map { $_->fileName }
grep { !$_->isDirectory }
$self->archive->members;
}
sub read_archive {
my ($self, $file) = @_;
my $archive = Archive::Zip->new();
$archive->read($file) == Archive::Zip::AZ_OK()
or Carp::croak "Failed to read zip file!";
return $archive;
}
1;
__END__
=pod
=encoding UTF-8
=for :stopwords Randy Stauner ACKNOWLEDGEMENTS TODO dist dists dir unix checksum checksums
=head1 NAME
Dist::Metadata::Zip - Enable Dist::Metadata for zip files
=head1 VERSION
version 0.927
=for test_synopsis my $path_to_archive;
=head1 SYNOPSIS
my $dist = Dist::Metadata->new(file => $path_to_archive);
=head1 DESCRIPTION
This is a subclass of L<Dist::Metadata::Dist>
(actually of L<Dist::Metadata::Archive>)
to enable determining the metadata from a zip file.
It's probably not very useful on it's own
and should be used from L<Dist::Metadata/new>.
=head1 AUTHOR
Randy Stauner <rwstauner@cpan.org>
=head1 COPYRIGHT AND LICENSE
This software is copyright (c) 2011 by Randy Stauner.
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
|