chazubell has asked for the wisdom of the Perl Monks concerning the following question:
However, while it worked on Linux, OSX, it was a failure on Windows. BTW: while stepping through the debugger i saw that the scalar $blackHoleDevice was set to 'nul' not the usual Windows /dev/null device 'NUL'. However even it it was then set to 'NUL' it still did not work. When $blackHoleDevice was replaced by an actual file name it worked fine, but one assumes that the use of /dev/null was used to avoid the actual creation of a file. Question: is this just windows or me?# Example of how to compute compressed sizes # $Revision: 1.2 $ use strict; use Archive::Zip qw(:ERROR_CODES); require File::Spec::Win32; my $zip = Archive::Zip->new(); my $blackHoleDevice = File::Spec::Win32->devnull(); $zip->addFile($_) foreach (<*.pl>); # Write and throw the data away. # after members are written, the writeOffset will be set # to the compressed size. $zip->writeToFileNamed($blackHoleDevice); my $totalSize = 0; my $totalCompressedSize = 0; foreach my $member ($zip->members()) { $totalSize += $member->uncompressedSize; $totalCompressedSize += $member->_writeOffset; print "Member ", $member->externalFileName, " size=", $member->uncompressedSize, ", writeOffset=", $member->_writeOffset, ", compressed=", $member->compressedSize, "\n"; } print "Total Size=", $totalSize, ", total compressed=", $totalCompress +edSize, "\n"; $zip->writeToFileNamed('test.zip');
|
|---|
| Replies are listed 'Best First'. | |
|---|---|
|
Re: Usage of File::Spec->devnull() on Windows
by tobyink (Canon) on Jul 30, 2012 at 16:27 UTC | |
by chazubell (Beadle) on Aug 02, 2012 at 16:28 UTC | |
|
Re: Usage of File::Spec->devnull() on Windows
by chazubell (Beadle) on Jul 30, 2012 at 16:25 UTC | |
by BrowserUk (Patriarch) on Jul 30, 2012 at 20:17 UTC | |
by moritz (Cardinal) on Jul 30, 2012 at 16:54 UTC | |
by MidLifeXis (Monsignor) on Jul 30, 2012 at 16:54 UTC |