Archive-SevenZip

 view release on metacpan or  search on metacpan

t/common.pm  view on Meta::CPAN

#--------- check to see if cat works

sub testCat {
    my $fh = IO::File->new(CATPIPE . OUTPUTZIP);
    binmode($fh);
    my $testString = pack('C256', 0 .. 255);
    my $testCrc = Archive::Zip::computeCRC32($testString);
    $fh->write($testString, length($testString)) or return 0;
    $fh->close();
    (-f OUTPUTZIP) or return 0;
    my @stat = stat(OUTPUTZIP);
    $stat[7] == length($testString) or return 0;
    fileCRC(OUTPUTZIP) == $testCrc  or return 0;
    unlink(OUTPUTZIP);
    return 1;
}

BEGIN {
    $catWorks = testCat();
    unless ($catWorks) {
        warn('warning: ', CAT, " doesn't seem to work, may skip some tests");

xt/copyright.t  view on Meta::CPAN

}

sub collect {
    my( $file ) = @_;
    note $file;
    my $modified_ts;
    if( $is_checkout ) {
        # diag `git log -1 --pretty="format:%ct" "$file"`;
        $modified_ts = `git log -1 --pretty="format:%ct" "$file"`;
    } else {
        $modified_ts = (stat($_))[9];
    }

    my $modified_year;
    if( $modified_ts ) {
        $modified_year = strftime('%Y', localtime($modified_ts));
    } else {
        $modified_year = 1970;
    };

    open my $fh, '<', $file



( run in 0.953 second using v1.01-cache-2.11-cpan-49f99fa48dc )