New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
IO::Compress::Zip::zip( '/some/where/file.txt' => '/some/where/else.zip' ) creates an archive of the input file #38
Comments
Hey Jacques, thanks for the feedback. As your script proves, my module will indeed read the contents of Apart from storing the compressed payload data, each entry in a zip archive needs a name associated with it. The most natural use-case when reading a file from the filesystem is to use that filename in the zip file. Thus when I run
and if I dump the uncompressed contents of the archive I get this
What behaviour were you expecting for the naming of the entry in the zip file? |
I already mentioned in my initial comment the expected behaviour, which is the one advertised in the documentation, i.e. "If the $input_filename_or_reference parameter is a simple scalar, it is assumed to be a filename. This file will be opened for reading and the input data will be read from it." (emphasis added) I think that, unless you want to modify the behaviour of your code, you need to amend the documentation accordingly. |
The documented behaviour for naming the members in a zip file are listed in the File Naming Options section
|
I did not see that, and that's because it is buried in the You decide, but I suggest you make it clearer. |
Fixed in 2.201 |
From ChangeLog 2.201 25 June 2022 * Disable zib header tests Sat Jun 25 09:10:59 2022 +0100 63eb5d37291b40dbf07d191a09b7876168008cd4 * Version 2.201 Sat Jun 25 09:00:42 2022 +0100 af51310f68bb225d94eaa29b7f3d2bece1935dfd * doc update pmqs/IO-Compress#38 Thu Jun 23 23:00:31 2022 +0100 2002d4fd3b3a6f5de6c6c3dc5989cf42581c1758 * Changes for zlib-ng Thu Jun 23 22:43:50 2022 +0100 2bd52d2918823cc567c3e92dd3d15f87cb4ee8f8 * Add perl 5.36 Sun Jun 5 13:34:18 2022 +0100 ede55370ed4c7eb3c66abc71bc25c7e4019b4c44 * force streaming zip file when writing to stdout * pmqs/IO-Compress#42 Sun Apr 24 19:43:19 2022 +0100 b57a3f83f404f5a24242680de5b406cfcf5c03ac * read zip timestamp in localtime Sun Apr 24 13:11:58 2022 +0100 0c838f43dc46f292714c82145c9add9932196b01 * streamzip: tighten up version tests for failing windows tests * pmqs/IO-Compress#41 Sun Apr 24 12:49:57 2022 +0100 3497645228235ea12c4d559d6dedd4cef47fc94a * streamzip: update year Sun Apr 24 12:11:35 2022 +0100 0ac0d1ef603d8854ffc35976196735b663764992 * Use Time::Local instead of POSIX::mktime Tue Apr 19 11:31:43 2022 +0100 64a106f1119cbc7dec8db52dca016bb8baacf2d4
From ChangeLog 2.201 25 June 2022 * Disable zib header tests Sat Jun 25 09:10:59 2022 +0100 63eb5d37291b40dbf07d191a09b7876168008cd4 * Version 2.201 Sat Jun 25 09:00:42 2022 +0100 af51310f68bb225d94eaa29b7f3d2bece1935dfd * doc update pmqs/IO-Compress#38 Thu Jun 23 23:00:31 2022 +0100 2002d4fd3b3a6f5de6c6c3dc5989cf42581c1758 * Changes for zlib-ng Thu Jun 23 22:43:50 2022 +0100 2bd52d2918823cc567c3e92dd3d15f87cb4ee8f8 * Add perl 5.36 Sun Jun 5 13:34:18 2022 +0100 ede55370ed4c7eb3c66abc71bc25c7e4019b4c44 * force streaming zip file when writing to stdout * pmqs/IO-Compress#42 Sun Apr 24 19:43:19 2022 +0100 b57a3f83f404f5a24242680de5b406cfcf5c03ac * read zip timestamp in localtime Sun Apr 24 13:11:58 2022 +0100 0c838f43dc46f292714c82145c9add9932196b01 * streamzip: tighten up version tests for failing windows tests * pmqs/IO-Compress#41 Sun Apr 24 12:49:57 2022 +0100 3497645228235ea12c4d559d6dedd4cef47fc94a * streamzip: update year Sun Apr 24 12:11:35 2022 +0100 0ac0d1ef603d8854ffc35976196735b663764992 * Use Time::Local instead of POSIX::mktime Tue Apr 19 11:31:43 2022 +0100 64a106f1119cbc7dec8db52dca016bb8baacf2d4
From ChangeLog 2.201 25 June 2022 * Disable zib header tests Sat Jun 25 09:10:59 2022 +0100 63eb5d37291b40dbf07d191a09b7876168008cd4 * Version 2.201 Sat Jun 25 09:00:42 2022 +0100 af51310f68bb225d94eaa29b7f3d2bece1935dfd * doc update pmqs/IO-Compress#38 Thu Jun 23 23:00:31 2022 +0100 2002d4fd3b3a6f5de6c6c3dc5989cf42581c1758 * Changes for zlib-ng Thu Jun 23 22:43:50 2022 +0100 2bd52d2918823cc567c3e92dd3d15f87cb4ee8f8 * Add perl 5.36 Sun Jun 5 13:34:18 2022 +0100 ede55370ed4c7eb3c66abc71bc25c7e4019b4c44 * force streaming zip file when writing to stdout * pmqs/IO-Compress#42 Sun Apr 24 19:43:19 2022 +0100 b57a3f83f404f5a24242680de5b406cfcf5c03ac * read zip timestamp in localtime Sun Apr 24 13:11:58 2022 +0100 0c838f43dc46f292714c82145c9add9932196b01 * streamzip: tighten up version tests for failing windows tests * pmqs/IO-Compress#41 Sun Apr 24 12:49:57 2022 +0100 3497645228235ea12c4d559d6dedd4cef47fc94a * streamzip: update year Sun Apr 24 12:11:35 2022 +0100 0ac0d1ef603d8854ffc35976196735b663764992 * Use Time::Local instead of POSIX::mktime Tue Apr 19 11:31:43 2022 +0100 64a106f1119cbc7dec8db52dca016bb8baacf2d4
The documentation from IO::Compress::Zip states
If the $input_filename_or_reference parameter is a simple scalar, it is assumed to be a filename. This file will be opened for reading and the input data will be read from it.
However, this is not true. if one does
IO::Compress::Zip::zip( '/some/where/file.txt' => '/some/where/output.zip' )
this will actually create an archive of/some/where/file.txt
rather than reading data from it as the documentation advertise.Calling the command line utility
unzip
on the resulting fileelse.zip
would result in a folder hierarchysome/where/file.txt
which shows the zip file keeps a record of the original fileHowever, if one use
IO::Uncompress::Zip::unzip
to decompressoutput.zip
, we do get back our original content.For example:
A look at
/tmp/output.zip
usingperl -MDevel::Hexdump=xd -lE 'say xd <>' /tmp/output.zip
proves that:The expected behaviour would have been to have the actual content of
file.txt
zipped and not the file also.The text was updated successfully, but these errors were encountered: