A Zip archive that contains files with absolute paths is strictly non-compliant with the zip specification. Below is taken from here
4.4.17.1 The name of the file, with optional relative path. The path stored MUST not contain a drive or device letter, or a leading slash. All slashes MUST be forward slashes '/' as opposed to backwards slashes '\' for compatibility with Amiga and UNIX file systems etc. If input came from standard input, there is no file name field.
I assume that Windows Explorer is using the strict interpretation of the zip spec.

The Archive::Zip docs do cover this in the addFile section

NOTE that you should not (generally) use absolute path names in zip member names, as this will cause problems with some zip tools as well as introduce a security hole and make the zip harder to use.

As mentioned already in Re: Archive::Zip problem with Windows Explorer Windows Explorer can display both the path & filename if it uses a relative path.

Something like this (untested) should allow you to store your files using a relative path.

foreach my $href ( @files_to_get ) { my $file = $href->{"files"}; print( " adding $file\n" ); my $name = $file; $name =~ s/^[A-Z]://; # remove drive $name =~ s#^[/\\]+##; # remove leading path delimiter $zip->addFile( $file, $name ); }

In reply to Re: Archive::Zip problem with Windows Explorer by pmqs
in thread Archive::Zip problem with Windows Explorer by anadem

Title:
Use:  <p> text here (a paragraph) </p>
and:  <code> code here </code>
to format your post, it's "PerlMonks-approved HTML":



  • Posts are HTML formatted. Put <p> </p> tags around your paragraphs. Put <code> </code> tags around your code and data!
  • Titles consisting of a single word are discouraged, and in most cases are disallowed outright.
  • Read Where should I post X? if you're not absolutely sure you're posting in the right place.
  • Please read these before you post! —
  • Posts may use any of the Perl Monks Approved HTML tags:
    a, abbr, b, big, blockquote, br, caption, center, col, colgroup, dd, del, details, div, dl, dt, em, font, h1, h2, h3, h4, h5, h6, hr, i, ins, li, ol, p, pre, readmore, small, span, spoiler, strike, strong, sub, summary, sup, table, tbody, td, tfoot, th, thead, tr, tt, u, ul, wbr
  • You may need to use entities for some characters, as follows. (Exception: Within code tags, you can put the characters literally.)
            For:     Use:
    & &amp;
    < &lt;
    > &gt;
    [ &#91;
    ] &#93;
  • Link using PerlMonks shortcuts! What shortcuts can I use for linking?
  • See Writeup Formatting Tips and other pages linked from there for more info.