/usr/share/perl5/Archive/Zip/NewFileMember.pm is in libarchive-zip-perl 1.30-6.
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 | package Archive::Zip::NewFileMember;
use strict;
use vars qw( $VERSION @ISA );
BEGIN {
$VERSION = '1.30';
@ISA = qw ( Archive::Zip::FileMember );
}
use Archive::Zip qw(
:CONSTANTS
:ERROR_CODES
:UTILITY_METHODS
);
# Given a file name, set up for eventual writing.
sub _newFromFileNamed {
my $class = shift;
my $fileName = shift; # local FS format
my $newName = shift;
$newName = _asZipDirName($fileName) unless defined($newName);
return undef unless ( stat($fileName) && -r _ && !-d _ );
my $self = $class->new(@_);
$self->{'fileName'} = $newName;
$self->{'externalFileName'} = $fileName;
$self->{'compressionMethod'} = COMPRESSION_STORED;
my @stat = stat(_);
$self->{'compressedSize'} = $self->{'uncompressedSize'} = $stat[7];
$self->desiredCompressionMethod(
( $self->compressedSize() > 0 )
? COMPRESSION_DEFLATED
: COMPRESSION_STORED
);
$self->unixFileAttributes( $stat[2] );
$self->setLastModFileDateTimeFromUnix( $stat[9] );
$self->isTextFile( -T _ );
return $self;
}
sub rewindData {
my $self = shift;
my $status = $self->SUPER::rewindData(@_);
return $status unless $status == AZ_OK;
return AZ_IO_ERROR unless $self->fh();
$self->fh()->clearerr();
$self->fh()->seek( 0, IO::Seekable::SEEK_SET )
or return _ioError( "rewinding", $self->externalFileName() );
return AZ_OK;
}
# Return bytes read. Note that first parameter is a ref to a buffer.
# my $data;
# my ( $bytesRead, $status) = $self->readRawChunk( \$data, $chunkSize );
sub _readRawChunk {
my ( $self, $dataRef, $chunkSize ) = @_;
return ( 0, AZ_OK ) unless $chunkSize;
my $bytesRead = $self->fh()->read( $$dataRef, $chunkSize )
or return ( 0, _ioError("reading data") );
return ( $bytesRead, AZ_OK );
}
# If I already exist, extraction is a no-op.
sub extractToFileNamed {
my $self = shift;
my $name = shift; # local FS name
if ( File::Spec->rel2abs($name) eq
File::Spec->rel2abs( $self->externalFileName() ) and -r $name )
{
return AZ_OK;
}
else {
return $self->SUPER::extractToFileNamed( $name, @_ );
}
}
1;
|