Archive-SevenZip

 view release on metacpan or  search on metacpan

lib/Archive/SevenZip/Entry.pm  view on Meta::CPAN

package Archive::SevenZip::Entry;
use strict;
use warnings;

use Archive::Zip::Member;
use Time::Piece; # for strptime
use File::Basename ();
use Path::Class ();

our $VERSION= '0.19';

sub new {
    my( $class, %options) = @_;

    bless \%options => $class
}

sub archive {
    $_[0]->{_Container}
}

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

    my $res = $self->{Path};

    # Normalize to unixy path names
    $res =~ s!\\!/!g;
    # If we're a directory, append the slash:
    if( exists $self->{Folder} and $self->{Folder} eq '+') {
        $res .= '/';
    };

    $res
}

# Class::Path API
sub basename {
    Path::Class::file( $_[0]->{Path} )->basename
}

sub components {
    my $cp = file( $_[0]->{Path} );
    $cp->components()
}

sub lastModTime {
    (my $dt = $_[0]->{Modified}) =~ s/\.\d+$//;
    Time::Piece->strptime($dt, '%Y-%m-%d %H:%M:%S')->epoch;
}

sub lastModFileDateTime {
    Archive::Zip::Member::_unixToDosTime($_[0]->lastModTime())
}

sub crc32 {
    hex( $_[0]->{CRC} );
}

sub crc32String {
    lc $_[0]->{CRC};
}

sub desiredCompressionMethod {
    $_[0]->{Method}
}

sub uncompressedSize {
    $_[0]->{Size}
}

sub dir {
    # We need to return the appropriate class here
    # so that further calls to (like) dir->list
    # still work properly

 view all matches for this distribution
 view release on metacpan -  search on metacpan

( run in 0.476 second using v1.00-cache-2.02-grep-82fe00e-cpan-1925d2aa809 )