Archive-Zip

 view release on metacpan or  search on metacpan

Changes  view on Meta::CPAN

    - Archive-Zip wrote faulty .zip files when $\ was set (such as when running
      using perl -l).
    - Incorporated a heavily modified version of ECARROLL's test file.
    - Thanks for ECARROLL for reporting it, and helping with the investigation.
    - The fix was to convert all $fh->print(@data) to $self->_print($fh, @data)
      where the _print() method localizes $\ to undef.
    - Fixed http://rt.cpan.org/Ticket/Display.html?id=14132 :
    - Incorrect file permissions after extraction.
    - Archive-Zip did not set the file permissions correctly in
      extractToFileNamed().
    - Added t/10_chmod.t and t/data/chmod.zip. Changed
      lib/Archive/Zip/Member.pm.
    - Reported by ak2 and jlv (Thanks!)
    - SHLOMIF wrote the test script.
    - (SHLOMIF)
    - Removed a double "required module" from the Archive::Zip POD.
    - Fixed http://rt.cpan.org/Ticket/Display.html?id=24557 ("documentation
      improvement"):
    - mentioned Archive::Zip::MemberRead in a few places.
    - TODO:
        - 1. Add a method to Archive::Zip to get a ::MemberRead from an

MANIFEST  view on Meta::CPAN

script/crc32
t/01_init.t
t/02_main.t
t/03_ex.t
t/04_readmember.t
t/05_tree.t
t/06_update.t
t/07_filenames_of_0.t
t/08_readmember_record_sep.t
t/09_output_record_sep.t
t/10_chmod.t
t/11_explorer.t
t/12_bug_47223.t
t/13_bug_46303.t
t/14_leading_separator.t
t/15_decrypt.t
t/16_decrypt.t
t/17_101092.t
t/18_bug_92205.t
t/19_bug_101240.t
t/20_bug_github11.t

MANIFEST  view on Meta::CPAN

t/22_deflated_dir.t
t/23_closed_handle.t
t/24_unicode_win32.t
t/25_traversal.t
t/26_bzip2.t
t/27_symlinks.t
t/28_zip64_unsupported.t
t/common.pm
t/data/bad_github11.zip
t/data/bzip.zip
t/data/chmod.zip
t/data/crypcomp.zip
t/data/crypt.zip
t/data/def.zip
t/data/defstr.zip
t/data/dotdot-from-unexistant-path.zip
t/data/empty.zip
t/data/emptydef.zip
t/data/emptydefstr.zip
t/data/emptystore.zip
t/data/emptystorestr.zip

lib/Archive/Zip/Member.pm  view on Meta::CPAN

        my ($status, $fh);
        if ($^O eq 'MSWin32' && $Archive::Zip::UNICODE) {
            Win32::CreateFile($name);
            ($status, $fh) = _newFileHandle(Win32::GetANSIPathName($name), 'w');
        } else {
            ($status, $fh) = _newFileHandle($name, 'w');
        }
        return _ioError("Can't open file $name for write") unless $status;
        $status = $self->extractToFileHandle($fh);
        $fh->close();
        chmod($self->unixFileAttributes(), $name)
          or return _error("Can't chmod() ${name}: $!");
        utime($self->lastModTime(), $self->lastModTime(), $name);
        return $status;
    }
}

sub mkpath_win32 {
    my $path = shift;
    use File::Spec;

    my ($volume, @path) = File::Spec->splitdir($path);

t/10_chmod.t  view on Meta::CPAN

    my $filename = shift;

    return (((stat($filename))[2]) & 07777);
}

sub test_perm {
    my $filename = shift;
    my $perm     = shift;

    # ignore errors here
    chmod($perm, $filename);

    return (get_perm($filename) == $perm);
}

sub test_if_chmod_is_working {
    my $test_file = testPath("test.file");

    open my $out, ">$test_file" or die;
    print {$out} "Foobar.";
    close($out);

    my $verdict =
        test_perm($test_file, 0444) &&
        test_perm($test_file, 0666) &&
        test_perm($test_file, 0444);

    unlink($test_file) or die;

    return $verdict;
}

if (!test_if_chmod_is_working()) {
    plan skip_all => "chmod() is not working on this machine.";
} else {
    plan tests => 4;
}

my $test_file = testPath("test.file");

my $zip = Archive::Zip->new();
isa_ok($zip, 'Archive::Zip');
azok($zip->read(dataPath("chmod.zip")));
azok($zip->memberNamed("test_dir/test_file")->extractToFileNamed($test_file));
is(get_perm($test_file), 0444, "File permission is OK.");



( run in 0.264 second using v1.01-cache-2.11-cpan-496ff517765 )