ext/Compress-Raw-Zlib/zlib-src/zutil.c Compress::Raw::Zlib
ext/Compress-Raw-Zlib/zlib-src/zutil.h Compress::Raw::Zlib
ext/Compress-Raw-Zlib/Zlib.xs Compress::Raw::Zlib
-ext/Compress-Zlib/Changes Compress::Zlib
-ext/Compress-Zlib/examples/filtdef Compress::Zlib
-ext/Compress-Zlib/examples/filtinf Compress::Zlib
-ext/Compress-Zlib/examples/gzcat Compress::Zlib
-ext/Compress-Zlib/examples/gzgrep Compress::Zlib
-ext/Compress-Zlib/examples/gzstream Compress::Zlib
-ext/Compress-Zlib/lib/Compress/Zlib.pm Compress::Zlib
-ext/Compress-Zlib/Makefile.PL Compress::Zlib
-ext/Compress-Zlib/pod/FAQ.pod Compress::Zlib
-ext/Compress-Zlib/private/MakeUtil.pm Compress::Zlib
-ext/Compress-Zlib/README Compress::Zlib
-ext/Compress-Zlib/t/01version.t Compress::Zlib
-ext/Compress-Zlib/t/03zlib-v1.t Compress::Zlib
-ext/Compress-Zlib/t/05examples.t Compress::Zlib
-ext/Compress-Zlib/t/06gzsetp.t Compress::Zlib
-ext/Compress-Zlib/t/08encoding.t Compress::Zlib
-ext/Compress-Zlib/t/14gzopen.t Compress::Zlib
ext/Cwd/Changes Cwd extension Changelog
ext/Cwd/Cwd.xs Cwd extension external subroutines
ext/Cwd/Makefile.PL Cwd extension makefile maker
ext/I18N-Langinfo/Makefile.PL I18N::Langinfo
ext/I18N-Langinfo/t/Langinfo.t See whether I18N::Langinfo works
ext/IO/ChangeLog IO perl module change log
-ext/IO_Compress_Base/Changes IO::Compress::Base
-ext/IO_Compress_Base/lib/File/GlobMapper.pm IO::Compress::Base
-ext/IO_Compress_Base/lib/IO/Compress/Base/Common.pm IO::Compress::Base
-ext/IO_Compress_Base/lib/IO/Compress/Base.pm IO::Compress::Base
-ext/IO_Compress_Base/lib/IO/Uncompress/AnyUncompress.pm IO::Compress::Base
-ext/IO_Compress_Base/lib/IO/Uncompress/Base.pm IO::Compress::Base
-ext/IO_Compress_Base/Makefile.PL IO::Compress::Base
-ext/IO_Compress_Base/pod/FAQ.pod IO::Compress::Base
-ext/IO_Compress_Base/private/MakeUtil.pm IO::Compress::Base
-ext/IO_Compress_Base/README IO::Compress::Base
-ext/IO_Compress_Base/t/01misc.t IO::Compress::Base
-ext/IO_Compress_Base/t/globmapper.t IO::Compress::Base
-ext/IO_Compress_Zlib/Changes IO::Compress::Zlib
-ext/IO_Compress_Zlib/examples/gzappend IO::Compress::Zlib
-ext/IO_Compress_Zlib/examples/gzcat IO::Compress::Zlib
-ext/IO_Compress_Zlib/examples/gzgrep IO::Compress::Zlib
-ext/IO_Compress_Zlib/examples/gzstream IO::Compress::Zlib
-ext/IO_Compress_Zlib/examples/unzip IO::Compress::Zlib
-ext/IO_Compress_Zlib/lib/IO/Compress/Adapter/Deflate.pm IO::Compress::Zlib
-ext/IO_Compress_Zlib/lib/IO/Compress/Adapter/Identity.pm IO::Compress::Zlib
-ext/IO_Compress_Zlib/lib/IO/Compress/Deflate.pm IO::Compress::Zlib
-ext/IO_Compress_Zlib/lib/IO/Compress/Gzip/Constants.pm IO::Compress::Zlib
-ext/IO_Compress_Zlib/lib/IO/Compress/Gzip.pm IO::Compress::Zlib
-ext/IO_Compress_Zlib/lib/IO/Compress/RawDeflate.pm IO::Compress::Zlib
-ext/IO_Compress_Zlib/lib/IO/Compress/Zip/Constants.pm IO::Compress::Zlib
-ext/IO_Compress_Zlib/lib/IO/Compress/Zip.pm IO::Compress::Zlib
-ext/IO_Compress_Zlib/lib/IO/Compress/Zlib/Constants.pm IO::Compress::Zlib
-ext/IO_Compress_Zlib/lib/IO/Compress/Zlib/Extra.pm IO::Compress::Zlib
-ext/IO_Compress_Zlib/lib/IO/Uncompress/Adapter/Identity.pm IO::Compress::Zlib
-ext/IO_Compress_Zlib/lib/IO/Uncompress/Adapter/Inflate.pm IO::Compress::Zlib
-ext/IO_Compress_Zlib/lib/IO/Uncompress/AnyInflate.pm IO::Compress::Zlib
-ext/IO_Compress_Zlib/lib/IO/Uncompress/Gunzip.pm IO::Compress::Zlib
-ext/IO_Compress_Zlib/lib/IO/Uncompress/Inflate.pm IO::Compress::Zlib
-ext/IO_Compress_Zlib/lib/IO/Uncompress/RawInflate.pm IO::Compress::Zlib
-ext/IO_Compress_Zlib/lib/IO/Uncompress/Unzip.pm IO::Compress::Zlib
-ext/IO_Compress_Zlib/Makefile.PL IO::Compress::Zlib
-ext/IO_Compress_Zlib/pod/FAQ.pod IO::Compress::Zlib
-ext/IO_Compress_Zlib/private/MakeUtil.pm IO::Compress::Zlib
-ext/IO_Compress_Zlib/README IO::Compress::Zlib
-ext/IO_Compress_Zlib/t/001zlib-generic-deflate.t IO::Compress::Zlib
-ext/IO_Compress_Zlib/t/001zlib-generic-gzip.t IO::Compress::Zlib
-ext/IO_Compress_Zlib/t/001zlib-generic-rawdeflate.t IO::Compress::Zlib
-ext/IO_Compress_Zlib/t/001zlib-generic-zip.t IO::Compress::Zlib
-ext/IO_Compress_Zlib/t/002any-deflate.t IO::Compress::Zlib
-ext/IO_Compress_Zlib/t/002any-gzip.t IO::Compress::Zlib
-ext/IO_Compress_Zlib/t/002any-rawdeflate.t IO::Compress::Zlib
-ext/IO_Compress_Zlib/t/002any-transparent.t IO::Compress::Zlib
-ext/IO_Compress_Zlib/t/002any-zip.t IO::Compress::Zlib
-ext/IO_Compress_Zlib/t/004gziphdr.t IO::Compress::Zlib
-ext/IO_Compress_Zlib/t/005defhdr.t IO::Compress::Zlib
-ext/IO_Compress_Zlib/t/006zip.t IO::Compress::Zlib
-ext/IO_Compress_Zlib/t/010examples.t IO::Compress::Zlib
-ext/IO_Compress_Zlib/t/020isize.t IO::Compress::Zlib
-ext/IO_Compress_Zlib/t/050interop-gzip.t IO::Compress::Zlib
-ext/IO_Compress_Zlib/t/100generic-deflate.t IO::Compress::Zlib
-ext/IO_Compress_Zlib/t/100generic-gzip.t IO::Compress::Zlib
-ext/IO_Compress_Zlib/t/100generic-rawdeflate.t IO::Compress::Zlib
-ext/IO_Compress_Zlib/t/100generic-zip.t IO::Compress::Zlib
-ext/IO_Compress_Zlib/t/101truncate-deflate.t IO::Compress::Zlib
-ext/IO_Compress_Zlib/t/101truncate-gzip.t IO::Compress::Zlib
-ext/IO_Compress_Zlib/t/101truncate-rawdeflate.t IO::Compress::Zlib
-ext/IO_Compress_Zlib/t/101truncate-zip.t IO::Compress::Zlib
-ext/IO_Compress_Zlib/t/102tied-deflate.t IO::Compress::Zlib
-ext/IO_Compress_Zlib/t/102tied-gzip.t IO::Compress::Zlib
-ext/IO_Compress_Zlib/t/102tied-rawdeflate.t IO::Compress::Zlib
-ext/IO_Compress_Zlib/t/102tied-zip.t IO::Compress::Zlib
-ext/IO_Compress_Zlib/t/103newtied-deflate.t IO::Compress::Zlib
-ext/IO_Compress_Zlib/t/103newtied-gzip.t IO::Compress::Zlib
-ext/IO_Compress_Zlib/t/103newtied-rawdeflate.t IO::Compress::Zlib
-ext/IO_Compress_Zlib/t/103newtied-zip.t IO::Compress::Zlib
-ext/IO_Compress_Zlib/t/104destroy-deflate.t IO::Compress::Zlib
-ext/IO_Compress_Zlib/t/104destroy-gzip.t IO::Compress::Zlib
-ext/IO_Compress_Zlib/t/104destroy-rawdeflate.t IO::Compress::Zlib
-ext/IO_Compress_Zlib/t/104destroy-zip.t IO::Compress::Zlib
-ext/IO_Compress_Zlib/t/105oneshot-deflate.t IO::Compress::Zlib
-ext/IO_Compress_Zlib/t/105oneshot-gzip-only.t IO::Compress::Zlib
-ext/IO_Compress_Zlib/t/105oneshot-gzip.t IO::Compress::Zlib
-ext/IO_Compress_Zlib/t/105oneshot-rawdeflate.t IO::Compress::Zlib
-ext/IO_Compress_Zlib/t/105oneshot-zip-only.t IO::Compress::Zlib
-ext/IO_Compress_Zlib/t/105oneshot-zip.t IO::Compress::Zlib
-ext/IO_Compress_Zlib/t/106prime-deflate.t IO::Compress::Zlib
-ext/IO_Compress_Zlib/t/106prime-gzip.t IO::Compress::Zlib
-ext/IO_Compress_Zlib/t/106prime-rawdeflate.t IO::Compress::Zlib
-ext/IO_Compress_Zlib/t/106prime-zip.t IO::Compress::Zlib
-ext/IO_Compress_Zlib/t/107multi-deflate.t IO::Compress::Zlib
-ext/IO_Compress_Zlib/t/107multi-gzip.t IO::Compress::Zlib
-ext/IO_Compress_Zlib/t/107multi-rawdeflate.t IO::Compress::Zlib
-ext/IO_Compress_Zlib/t/107multi-zip.t IO::Compress::Zlib
-ext/IO_Compress_Zlib/t/108anyunc-deflate.t IO::Compress::Zlib
-ext/IO_Compress_Zlib/t/108anyunc-gzip.t IO::Compress::Zlib
-ext/IO_Compress_Zlib/t/108anyunc-rawdeflate.t IO::Compress::Zlib
-ext/IO_Compress_Zlib/t/108anyunc-transparent.t IO::Compress::Zlib
-ext/IO_Compress_Zlib/t/108anyunc-zip.t IO::Compress::Zlib
-ext/IO_Compress_Zlib/t/109merge-deflate.t IO::Compress::Zlib
-ext/IO_Compress_Zlib/t/109merge-gzip.t IO::Compress::Zlib
-ext/IO_Compress_Zlib/t/109merge-rawdeflate.t IO::Compress::Zlib
-ext/IO_Compress_Zlib/t/109merge-zip.t IO::Compress::Zlib
-ext/IO_Compress_Zlib/t/110encode-deflate.t IO::Compress::Zlib
-ext/IO_Compress_Zlib/t/110encode-gzip.t IO::Compress::Zlib
-ext/IO_Compress_Zlib/t/110encode-rawdeflate.t IO::Compress::Zlib
-ext/IO_Compress_Zlib/t/110encode-zip.t IO::Compress::Zlib
ext/IO/hints/sco.pl Hint for IO for named architecture
ext/IO/IO.pm Top-level interface to IO::* classes
ext/IO/IO.xs IO extension external subroutines
ext/IO/t/io_unix.t See if UNIX socket-related methods from IO work
ext/IO/t/io_utf8.t See if perlio opens work
ext/IO/t/io_xs.t See if XSUB methods from IO work
+ext/IO-Compress/ IO::Compress
+ext/IO-Compress/t IO::Compress
+ext/IO-Compress/t/004gziphdr.t IO::Compress
+ext/IO-Compress/t/000prereq.t IO::Compress
+ext/IO-Compress/t/109merge-gzip.t IO::Compress
+ext/IO-Compress/t/109merge-deflate.t IO::Compress
+ext/IO-Compress/t/001zlib-generic-deflate.t IO::Compress
+ext/IO-Compress/t/103newtied-bzip2.t IO::Compress
+ext/IO-Compress/t/108anyunc-transparent.t IO::Compress
+ext/IO-Compress/t/107multi-gzip.t IO::Compress
+ext/IO-Compress/t/100generic-bzip2.t IO::Compress
+ext/IO-Compress/t/105oneshot-deflate.t IO::Compress
+ext/IO-Compress/t/106prime-zip.t IO::Compress
+ext/IO-Compress/t/101truncate-zip.t IO::Compress
+ext/IO-Compress/t/105oneshot-gzip.t IO::Compress
+ext/IO-Compress/t/106prime-rawdeflate.t IO::Compress
+ext/IO-Compress/t/105oneshot-rawdeflate.t IO::Compress
+ext/IO-Compress/t/01misc.t IO::Compress
+ext/IO-Compress/t/cz-06gzsetp.t IO::Compress
+ext/IO-Compress/t/001zlib-generic-gzip.t IO::Compress
+ext/IO-Compress/t/110encode-deflate.t IO::Compress
+ext/IO-Compress/t/001zlib-generic-zip.t IO::Compress
+ext/IO-Compress/t/105oneshot-gzip-only.t IO::Compress
+ext/IO-Compress/t/cz-05examples.t IO::Compress
+ext/IO-Compress/t/999pod.t IO::Compress
+ext/IO-Compress/t/101truncate-deflate.t IO::Compress
+ext/IO-Compress/t/100generic-deflate.t IO::Compress
+ext/IO-Compress/t/110encode-bzip2.t IO::Compress
+ext/IO-Compress/t/001bzip2.t IO::Compress
+ext/IO-Compress/t/006zip.t IO::Compress
+ext/IO-Compress/t/108anyunc-bzip2.t IO::Compress
+ext/IO-Compress/t/103newtied-zip.t IO::Compress
+ext/IO-Compress/t/005defhdr.t IO::Compress
+ext/IO-Compress/t/050interop-gzip.t IO::Compress
+ext/IO-Compress/t/globmapper.t IO::Compress
+ext/IO-Compress/t/110encode-zip.t IO::Compress
+ext/IO-Compress/t/cz-08encoding.t IO::Compress
+ext/IO-Compress/t/020isize.t IO::Compress
+ext/IO-Compress/t/109merge-rawdeflate.t IO::Compress
+ext/IO-Compress/t/108anyunc-gzip.t IO::Compress
+ext/IO-Compress/t/107multi-zip.t IO::Compress
+ext/IO-Compress/t/106prime-gzip.t IO::Compress
+ext/IO-Compress/t/99pod.t IO::Compress
+ext/IO-Compress/t/002any-transparent.t IO::Compress
+ext/IO-Compress/t/106prime-deflate.t IO::Compress
+ext/IO-Compress/t/105oneshot-zip-bzip2-only.t IO::Compress
+ext/IO-Compress/t/010examples-bzip2.t IO::Compress
+ext/IO-Compress/t/101truncate-gzip.t IO::Compress
+ext/IO-Compress/t/002any-rawdeflate.t IO::Compress
+ext/IO-Compress/t/107multi-bzip2.t IO::Compress
+ext/IO-Compress/t/103newtied-rawdeflate.t IO::Compress
+ext/IO-Compress/t/110encode-rawdeflate.t IO::Compress
+ext/IO-Compress/t/010examples-zlib.t IO::Compress
+ext/IO-Compress/t/102tied-deflate.t IO::Compress
+ext/IO-Compress/t/106prime-bzip2.t IO::Compress
+ext/IO-Compress/t/102tied-bzip2.t IO::Compress
+ext/IO-Compress/t/101truncate-bzip2.t IO::Compress
+ext/IO-Compress/t/001zlib-generic-rawdeflate.t IO::Compress
+ext/IO-Compress/t/102tied-rawdeflate.t IO::Compress
+ext/IO-Compress/t/102tied-gzip.t IO::Compress
+ext/IO-Compress/t/108anyunc-deflate.t IO::Compress
+ext/IO-Compress/t/104destroy-gzip.t IO::Compress
+ext/IO-Compress/t/108anyunc-zip.t IO::Compress
+ext/IO-Compress/t/105oneshot-zip-only.t IO::Compress
+ext/IO-Compress/t/100generic-rawdeflate.t IO::Compress
+ext/IO-Compress/t/110encode-gzip.t IO::Compress
+ext/IO-Compress/t/100generic-gzip.t IO::Compress
+ext/IO-Compress/t/002any-deflate.t IO::Compress
+ext/IO-Compress/t/107multi-deflate.t IO::Compress
+ext/IO-Compress/t/101truncate-rawdeflate.t IO::Compress
+ext/IO-Compress/t/105oneshot-zip.t IO::Compress
+ext/IO-Compress/t/100generic-zip.t IO::Compress
+ext/IO-Compress/t/103newtied-deflate.t IO::Compress
+ext/IO-Compress/t/cz-14gzopen.t IO::Compress
+ext/IO-Compress/t/002any-gzip.t IO::Compress
+ext/IO-Compress/t/102tied-zip.t IO::Compress
+ext/IO-Compress/t/cz-01version.t IO::Compress
+ext/IO-Compress/t/109merge-zip.t IO::Compress
+ext/IO-Compress/t/105oneshot-bzip2.t IO::Compress
+ext/IO-Compress/t/104destroy-rawdeflate.t IO::Compress
+ext/IO-Compress/t/104destroy-zip.t IO::Compress
+ext/IO-Compress/t/104destroy-bzip2.t IO::Compress
+ext/IO-Compress/t/108anyunc-rawdeflate.t IO::Compress
+ext/IO-Compress/t/002any-zip.t IO::Compress
+ext/IO-Compress/t/cz-99pod.t IO::Compress
+ext/IO-Compress/t/104destroy-deflate.t IO::Compress
+ext/IO-Compress/t/107multi-rawdeflate.t IO::Compress
+ext/IO-Compress/t/103newtied-gzip.t IO::Compress
+ext/IO-Compress/Changes IO::Compress
+ext/IO-Compress/lib IO::Compress
+ext/IO-Compress/lib/IO IO::Compress
+ext/IO-Compress/lib/IO/Uncompress IO::Compress
+ext/IO-Compress/lib/IO/Uncompress/Base.pm IO::Compress
+ext/IO-Compress/lib/IO/Uncompress/Inflate.pm IO::Compress
+ext/IO-Compress/lib/IO/Uncompress/Unzip.pm IO::Compress
+ext/IO-Compress/lib/IO/Uncompress/AnyUncompress.pm IO::Compress
+ext/IO-Compress/lib/IO/Uncompress/Adapter IO::Compress
+ext/IO-Compress/lib/IO/Uncompress/Adapter/Bunzip2.pm IO::Compress
+ext/IO-Compress/lib/IO/Uncompress/Adapter/Identity.pm IO::Compress
+ext/IO-Compress/lib/IO/Uncompress/Adapter/Inflate.pm IO::Compress
+ext/IO-Compress/lib/IO/Uncompress/AnyInflate.pm IO::Compress
+ext/IO-Compress/lib/IO/Uncompress/RawInflate.pm IO::Compress
+ext/IO-Compress/lib/IO/Uncompress/Bunzip2.pm IO::Compress
+ext/IO-Compress/lib/IO/Uncompress/Gunzip.pm IO::Compress
+ext/IO-Compress/lib/IO/Compress IO::Compress
+ext/IO-Compress/lib/IO/Compress/Zip IO::Compress
+ext/IO-Compress/lib/IO/Compress/Zip/Constants.pm IO::Compress
+ext/IO-Compress/lib/IO/Compress/RawDeflate.pm IO::Compress
+ext/IO-Compress/lib/IO/Compress/Bzip2.pm IO::Compress
+ext/IO-Compress/lib/IO/Compress/Zlib IO::Compress
+ext/IO-Compress/lib/IO/Compress/Zlib/Constants.pm IO::Compress
+ext/IO-Compress/lib/IO/Compress/Zlib/Extra.pm IO::Compress
+ext/IO-Compress/lib/IO/Compress/Adapter IO::Compress
+ext/IO-Compress/lib/IO/Compress/Adapter/Identity.pm IO::Compress
+ext/IO-Compress/lib/IO/Compress/Adapter/Deflate.pm IO::Compress
+ext/IO-Compress/lib/IO/Compress/Adapter/Bzip2.pm IO::Compress
+ext/IO-Compress/lib/IO/Compress/Gzip.pm IO::Compress
+ext/IO-Compress/lib/IO/Compress/Deflate.pm IO::Compress
+ext/IO-Compress/lib/IO/Compress/Zip.pm IO::Compress
+ext/IO-Compress/lib/IO/Compress/Gzip IO::Compress
+ext/IO-Compress/lib/IO/Compress/Gzip/Constants.pm IO::Compress
+ext/IO-Compress/lib/IO/Compress/Base.pm IO::Compress
+ext/IO-Compress/lib/IO/Compress/Base IO::Compress
+ext/IO-Compress/lib/IO/Compress/Base/Common.pm IO::Compress
+ext/IO-Compress/lib/Compress IO::Compress
+ext/IO-Compress/lib/Compress/Zlib.pm IO::Compress
+ext/IO-Compress/lib/File IO::Compress
+ext/IO-Compress/lib/File/GlobMapper.pm IO::Compress
+ext/IO-Compress/examples IO::Compress
+ext/IO-Compress/examples/io IO::Compress
+ext/IO-Compress/examples/io/anycat IO::Compress
+ext/IO-Compress/examples/io/bzip2 IO::Compress
+ext/IO-Compress/examples/io/bzip2/bzcat IO::Compress
+ext/IO-Compress/examples/io/bzip2/bzgrep IO::Compress
+ext/IO-Compress/examples/io/bzip2/bzstream IO::Compress
+ext/IO-Compress/examples/io/gzip IO::Compress
+ext/IO-Compress/examples/io/gzip/gzstream IO::Compress
+ext/IO-Compress/examples/io/gzip/gzcat IO::Compress
+ext/IO-Compress/examples/io/gzip/gzgrep IO::Compress
+ext/IO-Compress/examples/io/gzip/gzappend IO::Compress
+ext/IO-Compress/examples/compress-zlib IO::Compress
+ext/IO-Compress/examples/compress-zlib/gzstream IO::Compress
+ext/IO-Compress/examples/compress-zlib/gzcat IO::Compress
+ext/IO-Compress/examples/compress-zlib/filtdef IO::Compress
+ext/IO-Compress/examples/compress-zlib/gzgrep IO::Compress
+ext/IO-Compress/examples/compress-zlib/filtinf IO::Compress
+ext/IO-Compress/pod IO::Compress
+ext/IO-Compress/pod/FAQ.pod IO::Compress
+ext/IO-Compress/README IO::Compress
+ext/IO-Compress/private IO::Compress
+ext/IO-Compress/private/MakeUtil.pm IO::Compress
+ext/IO-Compress/Makefile.PL IO::Compress
+ext/IO-Compress/MANIFEST IO::Compress
ext/IPC-SysV/Changes IPC::SysV changes
ext/IPC-SysV/hints/cygwin.pl Hint for IPC::SysV for named architecture
ext/IPC-SysV/hints/next_3.pl Hint for IPC::SysV for named architecture
CHANGES
-------
- 2.016 26 February 2009
+ 2.017 26 February 2009
* Minor changes to allow building in perl core.
Compress-Raw-Bzip2
- Version 2.015
+ Version 2.017
- 2nd September 2008
+ 28th February 2009
- Copyright (c) 2005-2008 Paul Marquess. All rights reserved.
+ Copyright (c) 2005-2009 Paul Marquess. All rights reserved.
This program is free software; you can redistribute it
and/or modify it under the same terms as Perl itself.
If you haven't installed Compress-Raw-Bzip2 then search Compress::Raw::Bzip2.pm
for a line like this:
- $VERSION = "2.015" ;
+ $VERSION = "2.017" ;
c. The version of bzip2 you have used.
If you have successfully installed Compress-Raw-Bzip2, this one-liner
use bytes ;
our ($VERSION, $XS_VERSION, @ISA, @EXPORT, $AUTOLOAD);
-$VERSION = '2.015';
+$VERSION = '2.017';
$XS_VERSION = $VERSION;
$VERSION = eval $VERSION;
the uncompressed data will be appended to C<$output>. If not enabled,
C<$output> will be truncated before the uncompressed data is written to it.
+=head1 Misc
+
+=head2 my $version = Compress::Raw::Bzip2::bzlibversion();
+
+Returns the version of the underlying bzip2 library.
+
=head1 Constants
The following bzip2 constants are exported by this module
=head1 COPYRIGHT AND LICENSE
-Copyright (c) 2005-2008 Paul Marquess. All rights reserved.
+Copyright (c) 2005-2009 Paul Marquess. All rights reserved.
This program is free software; you can redistribute it and/or
modify it under the same terms as Perl itself.
=head1 COPYRIGHT AND LICENSE
-Copyright (c) 2005-2008 Paul Marquess. All rights reserved.
+Copyright (c) 2005-2009 Paul Marquess. All rights reserved.
This program is free software; you can redistribute it and/or
modify it under the same terms as Perl itself.
if eval { require Test::NoWarnings ; import Test::NoWarnings; 1 };
- my $VERSION = '2.015';
+ my $VERSION = '2.016';
my @NAMES = qw(
);
CHANGES
-------
+ 2.017 1 February 2009
+
+ * Added 'LimitOutput' option
+ TODO - document it
+
+ * Documented Compress::Raw::Zlib::zlib_version()
+
+ * Documented Compress::Raw::Zlib::deflateReset()
+ [RT #40566]
+
2.015 3 September 2008
* Makefile.PL
Compress-Raw-Zlib
- Version 2.015
+ Version 2.017
- 2nd September 2008
+ 28th February 2009
- Copyright (c) 2005-2008 Paul Marquess. All rights reserved.
+ Copyright (c) 2005-2009 Paul Marquess. All rights reserved.
This program is free software; you can redistribute it
and/or modify it under the same terms as Perl itself.
TROUBLESHOOTING
---------------
+Undefined Symbol gzsetparams
+----------------------------
+
+If you get the error shown below when you run the Compress-Raw-Zlib test
+harness it probably means you are running a copy of zlib that is
+version 1.0.5 or older.
+
+t/01version.........Can't load 'blib/arch/auto/Compress/Zlib/Zlib.so' for
+ module Compress::Raw::Zlib: blib/arch/auto/Compress/Raw/Zlib/Zlib.so:
+ undefined symbol: gzsetparams at ...
+
+There are two ways to fix this problem:
+
+ 1. Upgrade to the latest version of zlib.
+
+ 2. Edit config.in and set the OLD_ZLIB variable to True.
+
+Test Harness 01version fails
+----------------------------
+If the 01version test harness fails, and the problem isn't covered by the
+scenario above, it probably means that you have two versions of
+zlib installed on your system.
+
+Run the command below to see if this is indeed the case
+
+ make test TEST_VERBOSE=1 TEST_FILES=t/01version.t
+
+Try removing the one you don't want to use and rebuild.
+
Solaris build fails with "language optional software package not installed"
---------------------------------------------------------------------------
newer version of Compress-Raw-Zlib is available run this from the command
prompt
- C:\> ppm verify -upgrade Compress-Zlib
+ C:\> ppm verify -upgrade Compress-Raw-Zlib
If you are not running Activestate Perl and you don't have access
to a C compiler, you will not be able to build and install this module.
If you haven't installed Compress-Raw-Zlib then search Compress::Raw::Zlib.pm
for a line like this:
- $VERSION = "2.015" ;
+ $VERSION = "2.017" ;
c. The version of zlib you have used.
If you have successfully installed Compress-Raw-Zlib, this one-liner
* Created : 22nd January 1996
* Version : 2.000
*
- * Copyright (c) 1995-2007 Paul Marquess. All rights reserved.
+ * Copyright (c) 1995-2009 Paul Marquess. All rights reserved.
* This program is free software; you can redistribute it and/or
* modify it under the same terms as Perl itself.
*
bool eof
uInt cur_length = 0;
uInt prefix_length = 0;
- uInt increment = 0;
+ int increment = 0;
STRLEN stmp = NO_INIT
uLong bufinc = NO_INIT
PREINIT:
if((s->flags & FLAG_APPEND) != FLAG_APPEND) {
SvCUR_set(output, 0);
}
+
+ /* Assume no output buffer - the code below will update if there is any available */
+ s->stream.avail_out = 0;
+
+
if (SvLEN(output)) {
prefix_length = cur_length = SvCUR(output) ;
- s->stream.next_out = (Bytef*) SvPVbyte_nolen(output) + cur_length;
- increment = SvLEN(output) - cur_length - 1;
- s->stream.avail_out = increment;
- }
- else {
- s->stream.avail_out = 0;
+
+ if (s->flags & FLAG_LIMIT_OUTPUT && SvLEN(output) - cur_length - 1 < bufinc)
+ {
+ Sv_Grow(output, bufinc + cur_length + 1) ;
+ }
+
+ /* Only setup the stream output pointers if there is spare
+ capacity in the outout SV
+ */
+ if (SvLEN(output) > cur_length + 1)
+ {
+ s->stream.next_out = (Bytef*) SvPVbyte_nolen(output) + cur_length;
+ increment = SvLEN(output) - cur_length - 1;
+ s->stream.avail_out = increment;
+ }
}
+
+
s->bytesInflated = 0;
RETVAL = Z_OK;
while (RETVAL == Z_OK) {
- if (s->stream.avail_out == 0 ) {
+ if (s->stream.avail_out == 0) {
/* out of space in the output buffer so make it bigger */
Sv_Grow(output, SvLEN(output) + bufinc) ;
cur_length += increment ;
bufinc *= 2 ;
}
+ /* printf("INFLATE Availl In %d, Out %d\n", s->stream.avail_in,
+ s->stream.avail_out);
+DispStream(s, "BEFORE");
+Perl_sv_dump(output); */
RETVAL = inflate(&(s->stream), Z_SYNC_FLUSH);
+ /* printf("INFLATE returned %d %s, avail in %d, out %d\n", RETVAL,
+ GetErrorString(RETVAL), s->stream.avail_in, s->stream.avail_out); */
if (RETVAL == Z_NEED_DICT && s->dictionary) {
RETVAL = inflateSetDictionary(&(s->stream),
(const Bytef*)SvPVbyte_nolen(s->dictionary),
SvCUR(s->dictionary));
+ if (RETVAL == Z_OK)
+ continue;
}
- if (s->flags & FLAG_LIMIT_OUTPUT ||
- RETVAL == Z_STREAM_ERROR || RETVAL == Z_MEM_ERROR ||
- RETVAL == Z_DATA_ERROR || RETVAL == Z_STREAM_END )
+ if (s->flags & FLAG_LIMIT_OUTPUT &&
+ (RETVAL == Z_OK || RETVAL == Z_BUF_ERROR ))
+ break;
+
+ if (RETVAL == Z_STREAM_ERROR || RETVAL == Z_MEM_ERROR ||
+ RETVAL == Z_DATA_ERROR || RETVAL == Z_STREAM_END )
break ;
if (RETVAL == Z_BUF_ERROR) {
#endif
s->last_error = RETVAL ;
- if (RETVAL == Z_OK || RETVAL == Z_STREAM_END || RETVAL == Z_DATA_ERROR) {
- unsigned in ;
+ if (RETVAL == Z_OK || RETVAL == Z_STREAM_END || RETVAL == Z_BUF_ERROR || RETVAL == Z_DATA_ERROR) {
+ unsigned in ;
s->bytesInflated = cur_length + increment - s->stream.avail_out - prefix_length;
s->uncompressedBytes += s->bytesInflated ;
*SvEND(buf) = '\0';
SvSETMAGIC(buf);
}
+
}
OUTPUT:
RETVAL
use bytes ;
our ($VERSION, $XS_VERSION, @ISA, @EXPORT, $AUTOLOAD);
-$VERSION = '2.015';
+$VERSION = '2.017';
$XS_VERSION = $VERSION;
$VERSION = eval $VERSION;
($d, $status) = new Compress::Raw::Zlib::Deflate( [OPT] ) ;
$status = $d->deflate($input, $output) ;
$status = $d->flush($output [, $flush_type]) ;
+ $d->deflateReset() ;
$d->deflateParams(OPTS) ;
$d->deflateTune(OPTS) ;
$d->dict_adler() ;
$crc = adler32_combine($crc1, $crc2, $len2)l
$crc = crc32_combine($adler1, $adler2, $len2)
- ZLIB_VERSION
- ZLIB_VERNUM
+ my $version = Compress::Raw::Zlib::zlib_version();
=head1 DESCRIPTION
it is false, C<$output> will be truncated before any compressed data is
written to it.
+=head2 B<$status = $d-E<gt>deflateReset() >
+
+This method will reset the deflation object C<$d>. It can be used when you
+are compressing multiple data streams and want to use the same object to
+compress each of them. It should only be used once the previous data stream
+has been flushed successfully, i.e. a call to C<< $d->flush(Z_FINISH) >> has
+returned C<Z_OK>.
+
+Returns C<Z_OK> if successful.
+
=head2 B<$status = $d-E<gt>deflateParams([OPT])>
Change settings for the deflate object C<$d>.
=item B<-ConsumeInput>
If set to true, this option will remove compressed data from the input
-buffer of the the C< $i-E<gt>inflate > method as the inflate progresses.
+buffer of the C<< $i->inflate >> method as the inflate progresses.
This option can be useful when you are processing compressed data that is
embedded in another file/buffer. In this case the data that immediately
This option defaults to true.
+=item B<-LimitOutput>
+
+The C<LimitOutput> option changes the behavior of the C<< $i->inflate >>
+method so that the amount of memory used by the output buffer can be
+limited.
+
+When C<LimitOutput> is used the size of the output buffer used will either
+be the value of the C<Bufsize> option or the amount of memory already
+allocated to C<$output>, whichever is larger. Predicting the output size
+available is tricky, so don't rely on getting an exact output buffer size.
+
+When C<LimitOutout> is not specified C<< $i->inflate >> will use as much
+memory as it takes to write all the uncompressed data it creates by
+uncompressing the input buffer.
+
+See ?? for a discussion on why C<LimitOutput> is needed and how to use it.
+
+If C<LimitOutput> is enabled, the C<ConsumeInput> option will also be
+enabled.
+
+The input buffer may not have been fully processed, so the C<LimitOutput>
+option will enable C<ConsumeInput>
+
+This option defaults to false.
+
+B<Why LimitOutput?>
+
+By default C<< $i->inflate($input, $output) >> will uncompress I<all> data
+in C<$input> and write I<all> of the uncompressed data it has generated to
+C<$output>. This makes the interface to C<inflate> much simpler - if the
+method has uncompressed C<$input> successfully I<all> compressed data in
+C<$input> will have been dealt with. So if you are reading from an input
+source and uncompressing as you go the code will look something like this
+
+ use strict ;
+ use warnings ;
+
+ use Compress::Raw::Zlib;
+
+ my $x = new Compress::Raw::Zlib::Inflate()
+ or die "Cannot create a inflation stream\n" ;
+
+ my $input = '' ;
+
+ my ($output, $status) ;
+ while (read(STDIN, $input, 4096))
+ {
+ $status = $x->inflate($input, $output) ;
+
+ print $output ;
+
+ last if $status != Z_OK ;
+ }
+
+ die "inflation failed\n"
+ unless $status == Z_STREAM_END ;
+
+The points to note are
+
+=over 5
+
+=item *
+
+C<inflate> will only terminate the loop if it returns a status that isn't
+C<Z_OK>, i.e. the end of the compressed data stream has been reached or
+there has been an error in uncompression.
+
+=item *
+
+After the call to C<inflate> I<all> of the uncompressed data in C<$input>
+will have been processed. This means the subsequent call to C<read> can
+overwrite it's contents without any problem.
+
+=back
+
+For most use-cases the behavior described above is acceptable (this module
+and it's predecessor, C<Compress::Zlib>, have used it for over 10 years
+without an issue), but in a few very specific use-cases the amount of
+memory required for C<$output> can prohibitively large. For example, if the
+compressed data stream contains the same pattern repeated thousands of
+times a relatively small compressed data stream can uncompress into hundreds
+of megabytes. Remember C<inflate> will keep allocating memory until all
+the uncompressed data has been written to the output buffer - the size of
+C<$output> is unbounded.
+
+If you need to cope with this use-case, C<LimitOutput> is for you.
+
+The main difference in your code when using C<LimitOutput> is having to
+deal with cases where the C<$input> parameter still contains some
+uncompressed data that C<inflate> hasn't processed yet. Below is a typical
+code
+
+ use strict ;
+ use warnings ;
+
+ use Compress::Raw::Zlib;
+
+ my $x = new Compress::Raw::Zlib::Inflate(LimitOutput => 1)
+ or die "Cannot create a inflation stream\n" ;
+
+ my $input = '' ;
+ binmode STDIN;
+ binmode STDOUT;
+
+ my ($output, $status) ;
+
+ OUTER:
+ while (read(STDIN, $input, 4096))
+ {
+ do
+ {
+ $status = $x->inflate($input, $output) ;
+
+ print $output ;
+
+ last OUTER
+ unless $status == Z_OK || $status == Z_BUF_ERROR ;
+ }
+ while ($status == Z_OK && length $input);
+ }
+
+ die "inflation failed\n"
+ unless $status == Z_STREAM_END ;
+
+Points to note this time:
+
+=over 5
+
+=item *
+
+There are now two nested loops: the outer loop for reading the compressed
+data from STDIN; and the inner loop to repeatedly uncompress the C<$input>
+buffer.
+
+=item *
+
+There are two way the inner loop can be terminated
+
+=back
+
+If you know the underlying zlib interface, C<LimitOutput> will call the
+zlib C<inflate> function once
+
+Limiting the size of the output buffer means that there will be cases where
+C<$input> will not have been completely processed.
+
+See L</Examples> for an example of how to use C<LimitOutput>.
+
+it will return after a single call to the underlying
+zlib C<inflate> function.
+
+once the output buffer is full.
+
+As with the default it will also return if an error is encountered or the
+end of the compressed data stream is reached.
+
=back
Here is an example of using an optional parameter to override the default
Returns the buffer size used to carry out the decompression.
-=head2 Example
+=head2 Examples
Here is an example of using C<inflate>.
my ($output, $status) ;
while (read(STDIN, $input, 4096))
{
- $status = $x->inflate(\$input, $output) ;
+ $status = $x->inflate($input, $output) ;
print $output
if $status == Z_OK or $status == Z_STREAM_END ;
die "inflation failed\n"
unless $status == Z_STREAM_END ;
+The next example show how to use the C<LimitOutput> option. Notice the use
+of two nested loops in this case. The outer loop reads the data from the
+input source - STDIN and the inner loop repeatedly calls C<inflate> until
+C<$input> is exhausted, we get an error, or the end of the stream is
+reached. One point worth remembering is by using the C<LimitOutput> option
+you also get C<ConsumeInput> set as well - this makes the code below much
+simpler.
+
+ use strict ;
+ use warnings ;
+
+ use Compress::Raw::Zlib;
+
+ my $x = new Compress::Raw::Zlib::Inflate(LimitOutput => 1)
+ or die "Cannot create a inflation stream\n" ;
+
+ my $input = '' ;
+ binmode STDIN;
+ binmode STDOUT;
+
+ my ($output, $status) ;
+
+ OUTER:
+ while (read(STDIN, $input, 4096))
+ {
+ do
+ {
+ $status = $x->inflate($input, $output) ;
+
+ print $output ;
+
+ last OUTER
+ unless $status == Z_OK || $status == Z_BUF_ERROR ;
+ }
+ while ($status == Z_OK && length $input);
+ }
+
+ die "inflation failed\n"
+ unless $status == Z_STREAM_END ;
+
=head1 CHECKSUM FUNCTIONS
Two functions are provided by I<zlib> to calculate checksums. For the
These functions allow checksums to be merged.
+=head1 Misc
+
+=head2 my $version = Compress::Raw::Zlib::zlib_version();
+
+Returns the version of the zlib library.
+
=head1 ACCESSING ZIP FILES
Although it is possible (with some effort on your part) to use this
=head1 COPYRIGHT AND LICENSE
-Copyright (c) 2005-2008 Paul Marquess. All rights reserved.
+Copyright (c) 2005-2009 Paul Marquess. All rights reserved.
This program is free software; you can redistribute it and/or
modify it under the same terms as Perl itself.
=head1 COPYRIGHT AND LICENSE
-Copyright (c) 2005-2008 Paul Marquess. All rights reserved.
+Copyright (c) 2005-2009 Paul Marquess. All rights reserved.
This program is free software; you can redistribute it and/or
modify it under the same terms as Perl itself.
my $count = 0 ;
if ($] < 5.005) {
- $count = 229 ;
+ $count = 230 ;
}
elsif ($] >= 5.006) {
- $count = 283 ;
+ $count = 284 ;
}
else {
- $count = 241 ;
+ $count = 242 ;
}
plan tests => $count + $extra;
# create a flush point
cmp_ok $x->flush($Answer, Z_FULL_FLUSH), '==', Z_OK ;
+
+ my $len1 = length $Answer;
cmp_ok $x->deflate($goodbye, $Answer), '==', Z_OK;
cmp_ok $x->flush($Answer), '==', Z_OK ;
+ my $len2 = length($Answer) - $len1 ;
my ($first, @Answer) = split('', $Answer) ;
$GOT .= $Z if defined $Z ;
# print "x $status\n";
last if $status == Z_STREAM_END or $status != Z_OK ;
-
}
cmp_ok $status, '==', Z_DATA_ERROR ;
my $initial = $1 ;
- ok(($k, $err) = new Compress::Raw::Zlib::Inflate(-ConsumeInput => 0)) ;
+ ok(($k, $err) = new Compress::Raw::Zlib::Inflate(ConsumeInput => 0)) ;
ok $k ;
cmp_ok $err, '==', Z_OK ;
cmp_ok $status, '==', Z_OK
or diag "status '$status'\nlength rest is " . length($rest) . "\n" ;
- cmp_ok $k->inflate($rest, $GOT), '==', Z_DATA_ERROR;
- is $Z . $GOT, $goodbye ;
+ is length($rest), $len2, "expected compressed output";
+
+ $GOT = '';
+ cmp_ok $k->inflate($rest, $GOT), '==', Z_DATA_ERROR, "inflate returns Z_DATA_ERROR";
+ is $GOT, $goodbye ;
}
{
+++ /dev/null
-CHANGES
--------
-
- 2.015 3 September 2008
-
- * Makefile.PL
- Backout changes made in 2.014
-
- 2.014 2 September 2008
-
- * Makefile.PL
- Updated to check for indirect dependencies.
-
- 2.012 15 July 2008
-
- * No Changes
-
- 2.011 17 May 2008
-
- * No Changes
-
- 2.010 5 May 2008
-
- * Fixed problem that meant Perl 5.10 could not upgrade this module.
- [RT #35341]
-
- 2.009 20 April 2008
-
- * Minor documentation issue with flush.
- [rt.cpan.org #31446]
-
- 2.008 2 November 2007
-
- * Minor documentation changes in README
-
- 2.007 22 September 20007
-
- * lib/Compress/Zlib.pm -- 1.x Backward Compatability issues
- gzclose - documented return value was wrong, should be 0 for ok.
- gzflush - return value didn't match 1.x, should return 0 if ok.
- [rt.cpan.org #29215] and Debian bug #440943 http://bugs.debian.org/440943
-
- 2.006 1 September 20007
-
- * Makefile.PL
- Added INSTALLDIRS directive to install as a core module when built
- on a perl >= 5.9.
-
- * t/03zlib-v1.t
- Fixed crc32 and adler32 tests in to remove ascii assumption.
-
- * lib/Compress/Zlib.pm
- Make gzreadline not support $/, just like in Compress::Zlib 1.x
- Folk who want $/ with readline support can get it in
- IO::Uncompress::Gunzip.
- [rt.cpan.org #28663] and Debian bug #435656 http://bugs.debian.org/435656
- 2.005 18 June 2007
-
- * Added info about removing Compress::Zlib version 1, before
- installing version 2.
-
- 2.004 3 March 2007
-
- * rewrote memGzip using IO::Compress::Gzip::gzip
-
- 2.003 2 January 2007
-
- * Added explicit version checking
-
- 2.002 29 December 2006
-
- * Documentation updates.
-
- * Fix append mode with gzopen.
- rt-cpan.org 24041
-
- * Allow gzopen to read from and write to a scalar reference.
-
- 2.001 1 November 2006
-
- * Remove beta status.
-
- 2.000_14 26 October 2006
-
- * No changes.
-
- 2.000_13 20 June 2006
-
- * No changes.
-
- 2.000_12 16 April 2006
-
- * Fixed gzread to zap the output buffer to an empty string when zero
- bytes are requested. This matches the behaviour of C::Z 1.x
-
- 2.000_11 10 April 2006
-
- * No changes.
-
- 2.000_10 13 March 2006
-
- * Changed gzread so that its behaviour matches C::Z::gzread 1.x if it
- is called after eof. In this case it will write an empty string
- into the output parameter. This change is solely for backward
- compatability reasons.
-
- 2.000_09 3 March 2006
-
- * Posted to CPAN
-
- 2.000_08 2 March 2006
-
- * Breakout zlib specific code into separate modules.
-
- * Limited support for reading/writing zip files
-
- 2.000_06 5 October 2005
-
- * Added eof parameter to Compress::Zlib::inflate method.
-
- * Fixed issue with 64-bit
-
- 2.000_05 4 October 2005
-
- * Renamed IO::* to IO::Compress::* & IO::Uncompress::*
-
- 2.000_04 23 September 2005
-
- * Fixed some more non-portable test that were failing on VMS.
-
- * fixed problem where error messages in the oneshot interface were
- getting lost.
-
- 2.000_03 12 September 2005
-
- * Fixed some non-portable test that were failing on VMS.
-
- * Fixed export of zlib constants from the IO::* classes
-
- 2.000_02 6 September 2005
-
- * Split Append mode into Append and Merge
-
- * Fixed typos in the documentation.
-
- * Added pod/FAQ.pod
-
- * Added libscan to Makefile.PL
-
- * Added InputLength for IO::Gunzip et al
-
- 2.000_01 22 August 2005
-
- * Fixed VERSION in Compress::Gzip::Constants
-
- * Removed Compress::Gzip::Info from the distribution.
-
- 2.000_00 21 August 2005
-
- * First Beta relase of Compress::zlib rewrite.
-
- 1.38 - 6 September 2005
-
- * Integrate core change 25304 -- Symbian Update
-
- * Added libscan to Makefile.PL
-
- 1.37 - 12 August 2005
-
- * Change to t/03examples.t for VMS from Abe Timmerman
-
- 1.36 - 3 August 2005
-
- * Renamed zlib-src-1.2.3 to zlib-src to help VMS
-
- * Fixed Makefile.PL for VMS
-
- * Fixed t/03examples.t for VMS
-
- * Added a couple of notes about incompatibility with Unix compress.
-
- 1.35 - 16 July 2005
-
- * Updated zlib source to 1.2.3
-
- * Fixed problem with where two calls to gzclose would hang the debugger.
- See https://rt.cpan.org/Ticket/Display.html?id=13789
-
- * Added code from Alexey Tourbin to use XSLoader when available,
- and DynaLoader otherwise.
-
- * Documented that the compress & uncompress functions were not
- the same as the Unix utilities of the same name.
-
- * Fixed 05gzsetp -- it left a temp file hanging around.
-
- * Integrate core change 24787 - SvUPGRADE returns void in blead
-
- * Integrate core change 24788 - Makefile.PL adjustments for the core
-
-
- 1.34 - 30 January 2005
-
- * Fixed typo in the README
-
- * Fixed examples.t on Win32 where paths have embedded whitespace.
-
- * Fix for Cygwin and core integration from Jos I. Boumans
-
- * Upgrade zlib source to 1.2.2
-
- 1.33 - 14 January 2004
-
- * Reworked Makefile.PL to avoid creating a private copy of zlib.
- This both simplifies the build, plus it makes life easier for VMS.
-
- * Patches for Makefile.PL to get it to work on VMS supplied by
- Craig A. Berry.
-
- * memGunzip has very slow on FreeBSD. Turns out to be down to
- the way realloc works on FreeBSD. Changed both inflate & deflate
- to use exponentially increasing buffer sizes when they need to
- realloc. Thanks to Peter Jeremy for the lowdown on FreeBSD
- memory allocation.
-
- 1.32 - 26 November 2003
-
- * Steve Hay reported a problem on rt.cpan.org with Windows and
- MSCV++ 6.0 where the source from the zlib directory was getting
- installed with the rest of the module.
- https://rt.cpan.org/Ticket/Display.html?id=1741
-
- This has been fixed by renaming the "zlib" directory to "zlib-src"
- thus avoiding a conflict with the name of this Perl module.
-
- * Fixed a bug in the inflate method where the input buffer is an
- lvalue (via substr). Problem & solution reported by Salvador Fandiqo.
-
- * Tightened up the logic in Makefile.PL when BUILD_ZLIB is
- True. Issue spotted by Ralf S. Engelschall.
-
- 1.31 - 29 October 2003
-
- * Reinstated the creation of .bak files - $^I seems to need a
- backup file on Windows. For OpenVMS, the extenstion _bak is used.
-
- 1.30 - 28 October 2003
-
- * Bundled a sub-set of the zlib source with the module and changed
- the default make behaviour to build with the included zlib source.
- The previous behaviour of using a pre-built zlib library is
- still available for those that want it.
-
- * Added prototypes to the subs in Zlib.pm that didn't already have
- them. Patch from Ed Avis.
-
- * No .bak files are created by Makefile.PL any more - this keep
- distclean much happier. Patch suggested by Ed Avis.
- This also fixes a similar problem reported by Dr. Martin Zinser
- on OpenVMS.
-
- * Documentation for some of the gz functions updated.
-
- * Format strings modified in DispStream to keep OpenVMS happy.
- Problem reported by Dr. Martin Zinser.
-
-
- 1.22 - 17 June 2003
-
- * Makefile.PL now displays a warning about not installing
- Compress::Zlib via the CPAN shell.
-
- * Fix to allow intermingling of gzread & gzreadline - patch
- supplied by Doug Perham.
-
- * memGunzip will silently now work if the gzip trailer is
- missing. Some HTTP Origin Servers seem to leave it out.
-
- 1.21 - 28 April 2003
-
- * Tests 148 & 150 from t/02zlib.t were failing on redhat 9.
-
- * Added a few words about the problems with Mac OS X to the README file.
-
- 1.20 - 4 April 2003
-
- * Fixed bug in gzopen where $gzerrno wasn't being set correctly.
- The symptom was $gzerrno was set to Z_MEM_ERROR although the file
- was opened ok. If gzopen failed, $gzerrno was being set correctly.
- This problem wasn't spotted before because the typical test
- to determine whether gzopen passed or failed was to check its
- return value.
-
- 1.19 - 31 October 2002
-
- * fixed a problem with t/02zlib.t that was failing with redhat 8.
-
- 1.18 - 24 October 2002
-
- * fixed a Win32 problem in t/02zlib.t by changing sysread to read.
-
- * zlib 1.0.5 & older doesn't have gzsetparams & gzeof. Added a new
- variable to config.in to flag an old version of zlib. Split
- out the tests for gzsetparams into t/05gzsetp.t
-
- 1.17 - 23 May 2002
-
- * Moved the test to check the versions of libz & zlib.h into a separate
- file and added troubleshooting notes to README.
-
- * In gzopen, only attempt to call "tell" for normal files.
-
- * Fixed to work in taint mode.
-
- * Broke changes out of README into Changes file.
-
- * Replaced internal use of Z_PARTIAL_FLUSH symbol with Z_SYNC_FLUSH.
- zlib.h says /* will be removed, use Z_SYNC_FLUSH instead */
-
- 1.16 - 13 December 2001
-
- * Fixed bug in Makefile.PL that stopped "perl Makefile.PL PREFIX=..."
- working.
-
- 1.15 - 4th December 2001
-
- * Changes a few types to get the module to build on 64-bit Solaris
-
- * Changed the up/downgrade logic to default to the older constructs, and
- to only call a downgrade if specifically requested. Some older versions
- of Perl were having problems with the in-place edit.
-
- * added the new XS constant code.
-
- 1.14 - 27th August 2001
-
- * Memory overwrite bug fixed in "inflate". Kudos to Rob Simons for
- reporting the bug and to Anton Berezin for fixing it for me.
-
- 1.13 - 31st June 2001
-
- * Make sure config.in is consistant when released.
-
- 1.12 - 28th April 2001
-
- * Modified Makefile.PL to only enable the warnings pragma if
- using perl 5.6.1 or better.
-
- 1.11 - 17th February 2001
-
- * Added logic in Makefile.PL to toggle between using $^W and
- the warnings pragma in the module.
-
- * The module, the examples & the test harness are now all strict
- & warnings clean.
-
- 1.10 - 5th February 2001
-
- * fixed a bug in memGunzip. Used Z_ERR instead of Z_DATA_ERROR.
-
- 1.09 - 15th January 2001
-
- * Silenced a few compiler warnings.
-
- * Updated zlib home site in README & Zlib.pm to www.info-zip.org
-
- * Minor typo in Zlib.pm - a link used AUTHORS instead of AUTHOR
- -- spotted by Frank Martini.
-
- * Mention Archive::Zip
-
- * added memGunzip. This is largely based on code provided by Jim Leonard.
-
- * $deflate->flush can now take an optional parameter. Valid
- values are Z_NO_FLUSH, Z_PARTIAL_FLUSH, Z_SYNC_FLUSH, Z_FULL_FLUSH
- and Z_FINISH. The default is Z_FINISH.
-
- 1.08 - 6 Jan 2000
-
- * uncompress was clobbering its input parameter. Now it doesn't.
- This bug was spotted by Deven T. Corzine.
-
- * If a variable that only ever contained a number was given
- to compress or deflate, it would not be compressed properly. Now
- it will be coerced to a string and then compressed. This bug
- was spotted by Deven T. Corzine.
-
- 1.07 - 27 Nov 1999
-
- * ANSI-ified the static functions in Zlib.xs
-
- * Added the ability to build zlib along with the module.
- This feature is 90% based on a Makefile provided by Gurusamy
- Sarathy.
-
- 1.06 - 20 Sep 1999
-
- * Fixed a nasty problem where inflate could truncate the data
- returned. Thanks to Douglas Thomson <dougt@mugc.cc.monash.edu.au>
- for both spotting the problem and fixing the bug.
-
- * Added a note about the undocumented features in zlib that are
- required when accessing zip files.
-
- * gzclose will now get called automatically when the gzip object is
- destroyed.
-
- 1.05 - 3 June 1999
-
- * Previous release used newSVpvn, which doesn't exist in 5.004_04
- or earlier. Changed to use newSVpv instead.
-
- * The module needs Perl 5.004 or better, so updated the version
- checking in Zlib.pm and Makefile.PL
-
- 1.04 - 27 May 1999
-
- * Bug 19990527.001: compress(undef) core dumps -- Fixed.
-
- 1.03 - 17 Mar 1999
-
- * Updated to use the new PL_ symbols.
- Means the module can be built with Perl 5.005_5*
-
- 1.02 - 31 Jan 1999
-
- * The return codes for gzread, gzreadline and gzwrite were
- documented incorrectly as returning a status code.
-
- * The test harness was missing a "gzclose". This caused problem
- showed up on an amiga. Thanks to Erik van Roode for reporting
- this one.
-
- * Patched zlib.t for OS/2. Thanks to Ilya Zakharevich for the patch.
-
- 1.01 - 23 Nov 1997
-
- * A number of fixes to the test suite and the example scripts to
- allow them to work under win32. All courtesy of Gurusamy
- Sarathy.
-
- 1.00 - 14 Nov 1997
-
- * Fixed crc32 & adler32. They were very broken.
-
- * The following functions can now take a scalar reference in
- place of a scalar for their buffer parameters:
-
- compress
- uncompress
- deflate
- inflate
- crc32
- adler32
-
- This should mean applications that make use of the module don't
- have to copy large buffers around.
-
-
- * Normally the inflate method consumes I<all> of the input buffer
- before returning. The exception to this is when inflate detects
- the end of the stream (Z_STREAM_END). In this case the input
- buffer need not be completely consumed. To allow processing of
- file formats that embed a deflation stream (e.g. zip, gzip),
- the inflate method now sets the buffer parameter to be what
- remains after inflation.
-
- When the return status is Z_STREAM_END, it will be what remains
- of the buffer (if any) after deflation. When the status is Z_OK
- it will be an empty string.
-
- This change means that the buffer parameter must be a lvalue.
-
- * Fixed crc32 and adler32. They were both very broken.
-
- * Added the Compress::Zlib::memGzip function.
-
- 0.5 - Confirmed that no changes were necessary for zlib 1.0.3, or 1.0.4.
-
- The optional parameters for deflateInit and inflateInit can now
- be specified as an associative array in addition to a reference
- to an associative array. They can also accept the -Name
- syntax.
-
- gzopen can now optionally take a reference to an open
- filehandle in place of a filename. In this case it will call
- gzdopen.
-
- Added gzstream example script.
-
- 0.4 - Upgrade to support zlib 0.99
-
- Added dictionary interface.
-
- Fixed bug in gzreadline - previously it would keep returning
- the same buffer. This bug was reported by Helmut Jarausch
-
- Removed dependency to zutil.h and so dropped support for
-
- DEF_MEM_LEVEL (use MAX_MEM_LEVEL instead)
- DEF_WBITS (use MAX_WBITS instead)
-
- 0.3 - Added prototype specification.
-
- 0.2 - Fixed a minor allocation problem in Zlib.xs
-
- 0.1 - first alpha release. 2nd October 1995
+++ /dev/null
-#! perl -w
-
-use strict ;
-require 5.004 ;
-
-$::VERSION = '2.015' ;
-
-use private::MakeUtil;
-use ExtUtils::MakeMaker 5.16 ;
-
-
-UpDowngrade(getPerlFiles('MANIFEST'))
- unless $ENV{PERL_CORE};
-
-WriteMakefile(
- NAME => 'Compress::Zlib',
- VERSION_FROM => 'lib/Compress/Zlib.pm',
- 'dist' => { COMPRESS => 'gzip',
- TARFLAGS => '-chvf',
- SUFFIX => 'gz',
- DIST_DEFAULT => 'MyTrebleCheck tardist',
- },
-
- (
- $ENV{SKIP_FOR_CORE}
- ? (MAN3PODS => {})
- : (PREREQ_PM => { 'Compress::Raw::Zlib' => $::VERSION,
- 'IO::Compress::Base' => $::VERSION,
- 'IO::Compress::Base::Common' => $::VERSION,
- 'IO::Uncompress::Base' => $::VERSION,
- 'IO::Compress::Gzip' => $::VERSION,
- 'IO::Compress::Gzip::Constants' => $::VERSION,
- 'IO::Uncompress::Gunzip' => $::VERSION,
- 'Scalar::Util' => 0,
- }
- )
- ),
-
- (
- $] >= 5.005
- ? (ABSTRACT_FROM => 'lib/Compress/Zlib.pm',
- AUTHOR => 'Paul Marquess <pmqs@cpan.org>')
- : ()
- ),
-
- INSTALLDIRS => ($] >= 5.009 ? 'perl' : 'site'),
-
- (
- $] >= 5.009 && ! $ENV{PERL_CORE}
- ? (INST_LIB => 'blib/arch')
- : ()
- ),
-
- ((ExtUtils::MakeMaker->VERSION() gt '6.30') ?
- ('LICENSE' => 'perl') : ()),
-
-) ;
-
-# Check for Compress::Zlib version 1.
-eval "require Compress::Zlib; " ;
-if ( ! $ENV{PERL_CORE} && ! $@ && $Compress::Zlib::VERSION < 2)
-{
- my $ver = $Compress::Zlib::VERSION ;
- print <<EOM
-
-I see you already have Compress::Zlib version $ver installed.
-Version 1 MUST be removed for version 2 to operate correctly.
-
-The easiest way to do that is to install Compress::Zlib like this
-
- make install UNINST=1
-
-If you run the CPAN shell run this before installing Compress::Zlib
-
- o conf make_install_arg UNINST=1
-
-EOM
-}
-
-# end of file Makefile.PL
-
+++ /dev/null
-
- Compress-Zlib
-
- Version 2.015
-
- 2nd September 2008
-
- Copyright (c) 1995-2008 Paul Marquess. All rights reserved.
- This program is free software; you can redistribute it
- and/or modify it under the same terms as Perl itself.
-
-DESCRIPTION
------------
-
-This module provides a Perl interface to the zlib compression library.
-
-PREREQUISITES
--------------
-
-Before you can build Compress-Zlib you need to have the following
-installed on your system:
-
- * Perl 5.004 or better.
- * Compress::Raw::Zlib
- * IO::Compress::Gzip
-
-BUILDING THE MODULE
--------------------
-
-Assuming you have met all the prerequisites, the module can now be built
-using this sequence of commands:
-
- perl Makefile.PL
- make
- make test
-
-INSTALLATION
-------------
-
-To install Compress-Zlib, run the command below:
-
- make install
-
-TROUBLESHOOTING
----------------
-
-Undefined Symbol gzsetparams
-----------------------------
-
-If you get the error shown below when you run the Compress-Zlib test
-harness it probably means you are running a copy of zlib that is
-version 1.0.5 or older.
-
-t/01version.........Can't load 'blib/arch/auto/Compress/Zlib/Zlib.so' for
- module Compress::Raw::Zlib: blib/arch/auto/Compress/Raw/Zlib/Zlib.so:
- undefined symbol: gzsetparams at ...
-
-There are two ways to fix this problem:
-
- 1. Upgrade to the latest version of zlib.
-
- 2. Edit config.in and set the OLD_ZLIB variable to True.
-
-Test Harness 01version fails
-----------------------------
-If the 01version test harness fails, and the problem isn't covered by the
-scenario above, it probably means that you have two versions of
-zlib installed on your system.
-
-Run the command below to see if this is indeed the case
-
- make test TEST_VERBOSE=1 TEST_FILES=t/01version.t
-
-Try removing the one you don't want to use and rebuild.
-
-FEEDBACK
---------
-
-How to report a problem with Compress-Zlib.
-
-To help me help you, I need all of the following information:
-
- 1. The Versions of everything relevant.
- This includes:
-
- a. The *complete* output from running this
-
- perl -V
-
- Do not edit the output in any way.
- Note, I want you to run "perl -V" and NOT "perl -v".
-
- If your perl does not understand the "-V" option it is too
- old. This module needs Perl version 5.004 or better.
-
- b. The version of Compress-Zlib you have.
- If you have successfully installed Compress-Zlib, this one-liner
- will tell you:
-
- perl -MCompress::Zlib -e 'print qq[ver $Compress::Zlib::VERSION\n]'
-
- If you are running windows use this
-
- perl -MCompress::Zlib -e "print qq[ver $Compress::Zlib::VERSION\n]"
-
- If you haven't installed Compress-Zlib then search Compress::Zlib.pm
- for a line like this:
-
- $VERSION = "2.015" ;
-
- 2. If you are having problems building Compress-Zlib, send me a
- complete log of what happened. Start by unpacking the Compress-Zlib
- module into a fresh directory and keep a log of all the steps
-
- [edit config.in, if necessary]
- perl Makefile.PL
- make
- make test TEST_VERBOSE=1
-
-Paul Marquess <pmqs@cpan.org>
+++ /dev/null
-
-=head1 NAME
-
-Compress::Zlib::FAQ -- Frequently Asked Questions about Compress::Zlib
-
-=head1 DESCRIPTION
-
-Common questions answered.
-
-=head2 Compatibility with Unix compress/uncompress.
-
-Although C<Compress::Zlib> has a pair of functions called C<compress> and
-C<uncompress>, they are I<not> related to the Unix programs of the same
-name. The C<Compress::Zlib> module is not compatible with Unix
-C<compress>.
-
-If you have the C<uncompress> program available, you can use this to read
-compressed files
-
- open F, "uncompress -c $filename |";
- while (<F>)
- {
- ...
-
-Alternatively, if you have the C<gunzip> program available, you can use
-this to read compressed files
-
- open F, "gunzip -c $filename |";
- while (<F>)
- {
- ...
-
-and this to write compress files, if you have the C<compress> program
-available
-
- open F, "| compress -c $filename ";
- print F "data";
- ...
- close F ;
-
-=head2 Accessing .tar.Z files
-
-The C<Archive::Tar> module can optionally use C<Compress::Zlib> (via the
-C<IO::Zlib> module) to access tar files that have been compressed with
-C<gzip>. Unfortunately tar files compressed with the Unix C<compress>
-utility cannot be read by C<Compress::Zlib> and so cannot be directly
-accessed by C<Archive::Tar>.
-
-If the C<uncompress> or C<gunzip> programs are available, you can use one
-of these workarounds to read C<.tar.Z> files from C<Archive::Tar>
-
-Firstly with C<uncompress>
-
- use strict;
- use warnings;
- use Archive::Tar;
-
- open F, "uncompress -c $filename |";
- my $tar = Archive::Tar->new(*F);
- ...
-
-and this with C<gunzip>
-
- use strict;
- use warnings;
- use Archive::Tar;
-
- open F, "gunzip -c $filename |";
- my $tar = Archive::Tar->new(*F);
- ...
-
-Similarly, if the C<compress> program is available, you can use this to
-write a C<.tar.Z> file
-
- use strict;
- use warnings;
- use Archive::Tar;
- use IO::File;
-
- my $fh = new IO::File "| compress -c >$filename";
- my $tar = Archive::Tar->new();
- ...
- $tar->write($fh);
- $fh->close ;
-
-=head2 Accessing Zip Files
-
-This module does not support reading/writing zip files.
-
-Support for reading/writing zip files is included with the
-C<IO::Compress::Zip> and C<IO::Uncompress::Unzip> modules.
-
-The primary focus of the C<IO::Compress::Zip> and C<IO::Uncompress::Unzip>
-modules is to provide an C<IO::File> compatible streaming read/write
-interface to zip files/buffers. They are not fully flegged archivers. If
-you are looking for an archiver check out the C<Archive::Zip> module. You
-can find it on CPAN at
-
- http://www.cpan.org/modules/by-module/Archive/Archive-Zip-*.tar.gz
-
-=head1 SEE ALSO
-
-L<Compress::Zlib>, L<IO::Compress::Gzip>, L<IO::Uncompress::Gunzip>, L<IO::Compress::Deflate>, L<IO::Uncompress::Inflate>, L<IO::Compress::RawDeflate>, L<IO::Uncompress::RawInflate>, L<IO::Compress::Bzip2>, L<IO::Uncompress::Bunzip2>, L<IO::Compress::Lzop>, L<IO::Uncompress::UnLzop>, L<IO::Compress::Lzf>, L<IO::Uncompress::UnLzf>, L<IO::Uncompress::AnyInflate>, L<IO::Uncompress::AnyUncompress>
-
-L<Compress::Zlib::FAQ|Compress::Zlib::FAQ>
-
-L<File::GlobMapper|File::GlobMapper>, L<Archive::Zip|Archive::Zip>,
-L<Archive::Tar|Archive::Tar>,
-L<IO::Zlib|IO::Zlib>
-
-=head1 AUTHOR
-
-This module was written by Paul Marquess, F<pmqs@cpan.org>.
-
-=head1 MODIFICATION HISTORY
-
-See the Changes file.
-
-=head1 COPYRIGHT AND LICENSE
-
-Copyright (c) 2005-2008 Paul Marquess. All rights reserved.
-
-This program is free software; you can redistribute it and/or
-modify it under the same terms as Perl itself.
-
+++ /dev/null
-BEGIN {
- if ($ENV{PERL_CORE}) {
- chdir 't' if -d 't';
- @INC = ("../lib", "lib/compress");
- }
-}
-
-use lib qw(t t/compress);
-use strict;
-use warnings;
-use bytes;
-
-use Test::More ;
-use CompTestUtils;
-use Symbol;
-
-BEGIN
-{
- # use Test::NoWarnings, if available
- my $extra = 0 ;
- $extra = 1
- if eval { require Test::NoWarnings ; import Test::NoWarnings; 1 };
-
- my $count = 0 ;
- if ($] < 5.005) {
- $count = 390 ;
- }
- else {
- $count = 401 ;
- }
-
-
- plan tests => $count + $extra ;
-
- use_ok('Compress::Zlib', 2) ;
- use_ok('IO::Compress::Gzip::Constants') ;
-
- use_ok('IO::Compress::Gzip', qw($GzipError)) ;
-}
-
-
-my $hello = <<EOM ;
-hello world
-this is a test
-EOM
-
-my $len = length $hello ;
-
-# Check zlib_version and ZLIB_VERSION are the same.
-is Compress::Zlib::zlib_version, ZLIB_VERSION,
- "ZLIB_VERSION matches Compress::Zlib::zlib_version" ;
-
-# generate a long random string
-my $contents = '' ;
-foreach (1 .. 5000)
- { $contents .= chr int rand 256 }
-
-my $x ;
-my $fil;
-
-# compress/uncompress tests
-# =========================
-
-eval { compress([1]); };
-ok $@ =~ m#not a scalar reference#
- or print "# $@\n" ;;
-
-eval { uncompress([1]); };
-ok $@ =~ m#not a scalar reference#
- or print "# $@\n" ;;
-
-$hello = "hello mum" ;
-my $keep_hello = $hello ;
-
-my $compr = compress($hello) ;
-ok $compr ne "" ;
-
-my $keep_compr = $compr ;
-
-my $uncompr = uncompress ($compr) ;
-
-ok $hello eq $uncompr ;
-
-ok $hello eq $keep_hello ;
-ok $compr eq $keep_compr ;
-
-# compress a number
-$hello = 7890 ;
-$keep_hello = $hello ;
-
-$compr = compress($hello) ;
-ok $compr ne "" ;
-
-$keep_compr = $compr ;
-
-$uncompr = uncompress ($compr) ;
-
-ok $hello eq $uncompr ;
-
-ok $hello eq $keep_hello ;
-ok $compr eq $keep_compr ;
-
-# bigger compress
-
-$compr = compress ($contents) ;
-ok $compr ne "" ;
-
-$uncompr = uncompress ($compr) ;
-
-ok $contents eq $uncompr ;
-
-# buffer reference
-
-$compr = compress(\$hello) ;
-ok $compr ne "" ;
-
-
-$uncompr = uncompress (\$compr) ;
-ok $hello eq $uncompr ;
-
-# bad level
-$compr = compress($hello, 1000) ;
-ok ! defined $compr;
-
-# change level
-$compr = compress($hello, Z_BEST_COMPRESSION) ;
-ok defined $compr;
-$uncompr = uncompress (\$compr) ;
-ok $hello eq $uncompr ;
-
-# corrupt data
-$compr = compress(\$hello) ;
-ok $compr ne "" ;
-
-substr($compr,0, 1) = "\xFF";
-ok !defined uncompress (\$compr) ;
-
-# deflate/inflate - small buffer
-# ==============================
-
-$hello = "I am a HAL 9000 computer" ;
-my @hello = split('', $hello) ;
-my ($err, $X, $status);
-
-ok (($x, $err) = deflateInit( {-Bufsize => 1} ) ) ;
-ok $x ;
-ok $err == Z_OK ;
-
-my $Answer = '';
-foreach (@hello)
-{
- ($X, $status) = $x->deflate($_) ;
- last unless $status == Z_OK ;
-
- $Answer .= $X ;
-}
-
-ok $status == Z_OK ;
-
-ok ((($X, $status) = $x->flush())[1] == Z_OK ) ;
-$Answer .= $X ;
-
-
-my @Answer = split('', $Answer) ;
-
-my $k;
-ok (($k, $err) = inflateInit( {-Bufsize => 1}) ) ;
-ok $k ;
-ok $err == Z_OK ;
-
-my $GOT = '';
-my $Z;
-foreach (@Answer)
-{
- ($Z, $status) = $k->inflate($_) ;
- $GOT .= $Z ;
- last if $status == Z_STREAM_END or $status != Z_OK ;
-
-}
-
-ok $status == Z_STREAM_END ;
-ok $GOT eq $hello ;
-
-
-title 'deflate/inflate - small buffer with a number';
-# ==============================
-
-$hello = 6529 ;
-
-ok (($x, $err) = deflateInit( {-Bufsize => 1} ) ) ;
-ok $x ;
-ok $err == Z_OK ;
-
-ok !defined $x->msg() ;
-ok $x->total_in() == 0 ;
-ok $x->total_out() == 0 ;
-$Answer = '';
-{
- ($X, $status) = $x->deflate($hello) ;
-
- $Answer .= $X ;
-}
-
-ok $status == Z_OK ;
-
-ok ((($X, $status) = $x->flush())[1] == Z_OK ) ;
-$Answer .= $X ;
-
-ok !defined $x->msg() ;
-ok $x->total_in() == length $hello ;
-ok $x->total_out() == length $Answer ;
-
-
-@Answer = split('', $Answer) ;
-
-ok (($k, $err) = inflateInit( {-Bufsize => 1}) ) ;
-ok $k ;
-ok $err == Z_OK ;
-
-ok !defined $k->msg() ;
-ok $k->total_in() == 0 ;
-ok $k->total_out() == 0 ;
-
-$GOT = '';
-foreach (@Answer)
-{
- ($Z, $status) = $k->inflate($_) ;
- $GOT .= $Z ;
- last if $status == Z_STREAM_END or $status != Z_OK ;
-
-}
-
-ok $status == Z_STREAM_END ;
-ok $GOT eq $hello ;
-
-ok !defined $k->msg() ;
-is $k->total_in(), length $Answer ;
-ok $k->total_out() == length $hello ;
-
-
-
-title 'deflate/inflate - larger buffer';
-# ==============================
-
-
-ok $x = deflateInit() ;
-
-ok ((($X, $status) = $x->deflate($contents))[1] == Z_OK) ;
-
-my $Y = $X ;
-
-
-ok ((($X, $status) = $x->flush() )[1] == Z_OK ) ;
-$Y .= $X ;
-
-
-
-ok $k = inflateInit() ;
-
-($Z, $status) = $k->inflate($Y) ;
-
-ok $status == Z_STREAM_END ;
-ok $contents eq $Z ;
-
-title 'deflate/inflate - preset dictionary';
-# ===================================
-
-my $dictionary = "hello" ;
-ok $x = deflateInit({-Level => Z_BEST_COMPRESSION,
- -Dictionary => $dictionary}) ;
-
-my $dictID = $x->dict_adler() ;
-
-($X, $status) = $x->deflate($hello) ;
-ok $status == Z_OK ;
-($Y, $status) = $x->flush() ;
-ok $status == Z_OK ;
-$X .= $Y ;
-$x = 0 ;
-
-ok $k = inflateInit(-Dictionary => $dictionary) ;
-
-($Z, $status) = $k->inflate($X);
-ok $status == Z_STREAM_END ;
-ok $k->dict_adler() == $dictID;
-ok $hello eq $Z ;
-
-#$Z='';
-#while (1) {
-# ($Z, $status) = $k->inflate($X) ;
-# last if $status == Z_STREAM_END or $status != Z_OK ;
-#print "status=[$status] hello=[$hello] Z=[$Z]\n";
-#}
-#ok $status == Z_STREAM_END ;
-#ok $hello eq $Z
-# or print "status=[$status] hello=[$hello] Z=[$Z]\n";
-
-
-
-
-
-
-title 'inflate - check remaining buffer after Z_STREAM_END';
-# ===================================================
-
-{
- ok $x = deflateInit(-Level => Z_BEST_COMPRESSION ) ;
-
- ($X, $status) = $x->deflate($hello) ;
- ok $status == Z_OK ;
- ($Y, $status) = $x->flush() ;
- ok $status == Z_OK ;
- $X .= $Y ;
- $x = 0 ;
-
- ok $k = inflateInit() ;
-
- my $first = substr($X, 0, 2) ;
- my $last = substr($X, 2) ;
- ($Z, $status) = $k->inflate($first);
- ok $status == Z_OK ;
- ok $first eq "" ;
-
- $last .= "appendage" ;
- my $T;
- ($T, $status) = $k->inflate($last);
- ok $status == Z_STREAM_END ;
- ok $hello eq $Z . $T ;
- ok $last eq "appendage" ;
-
-}
-
-title 'memGzip & memGunzip';
-{
- my $name = "test.gz" ;
- my $buffer = <<EOM;
-some sample
-text
-
-EOM
-
- my $len = length $buffer ;
- my ($x, $uncomp) ;
-
-
- # create an in-memory gzip file
- my $dest = Compress::Zlib::memGzip($buffer) ;
- ok length $dest ;
-
- # write it to disk
- ok open(FH, ">$name") ;
- binmode(FH);
- print FH $dest ;
- close FH ;
-
- # uncompress with gzopen
- ok my $fil = gzopen($name, "rb") ;
-
- is $fil->gzread($uncomp, 0), 0 ;
- ok (($x = $fil->gzread($uncomp)) == $len) ;
-
- ok ! $fil->gzclose ;
-
- ok $uncomp eq $buffer ;
-
- 1 while unlink $name ;
-
- # now check that memGunzip can deal with it.
- my $ungzip = Compress::Zlib::memGunzip($dest) ;
- ok defined $ungzip ;
- ok $buffer eq $ungzip ;
-
- # now do the same but use a reference
-
- $dest = Compress::Zlib::memGzip(\$buffer) ;
- ok length $dest ;
-
- # write it to disk
- ok open(FH, ">$name") ;
- binmode(FH);
- print FH $dest ;
- close FH ;
-
- # uncompress with gzopen
- ok $fil = gzopen($name, "rb") ;
-
- ok (($x = $fil->gzread($uncomp)) == $len) ;
-
- ok ! $fil->gzclose ;
-
- ok $uncomp eq $buffer ;
-
- # now check that memGunzip can deal with it.
- my $keep = $dest;
- $ungzip = Compress::Zlib::memGunzip(\$dest) ;
- ok defined $ungzip ;
- ok $buffer eq $ungzip ;
-
- # check memGunzip can cope with missing gzip trailer
- my $minimal = substr($keep, 0, -1) ;
- $ungzip = Compress::Zlib::memGunzip(\$minimal) ;
- ok defined $ungzip ;
- ok $buffer eq $ungzip ;
-
- $minimal = substr($keep, 0, -2) ;
- $ungzip = Compress::Zlib::memGunzip(\$minimal) ;
- ok defined $ungzip ;
- ok $buffer eq $ungzip ;
-
- $minimal = substr($keep, 0, -3) ;
- $ungzip = Compress::Zlib::memGunzip(\$minimal) ;
- ok defined $ungzip ;
- ok $buffer eq $ungzip ;
-
- $minimal = substr($keep, 0, -4) ;
- $ungzip = Compress::Zlib::memGunzip(\$minimal) ;
- ok defined $ungzip ;
- ok $buffer eq $ungzip ;
-
- $minimal = substr($keep, 0, -5) ;
- $ungzip = Compress::Zlib::memGunzip(\$minimal) ;
- ok defined $ungzip ;
- ok $buffer eq $ungzip ;
-
- $minimal = substr($keep, 0, -6) ;
- $ungzip = Compress::Zlib::memGunzip(\$minimal) ;
- ok defined $ungzip ;
- ok $buffer eq $ungzip ;
-
- $minimal = substr($keep, 0, -7) ;
- $ungzip = Compress::Zlib::memGunzip(\$minimal) ;
- ok defined $ungzip ;
- ok $buffer eq $ungzip ;
-
- $minimal = substr($keep, 0, -8) ;
- $ungzip = Compress::Zlib::memGunzip(\$minimal) ;
- ok defined $ungzip ;
- ok $buffer eq $ungzip ;
-
- $minimal = substr($keep, 0, -9) ;
- $ungzip = Compress::Zlib::memGunzip(\$minimal) ;
- ok ! defined $ungzip ;
-
-
- 1 while unlink $name ;
-
- # check corrupt header -- too short
- $dest = "x" ;
- my $result = Compress::Zlib::memGunzip($dest) ;
- ok !defined $result ;
-
- # check corrupt header -- full of junk
- $dest = "x" x 200 ;
- $result = Compress::Zlib::memGunzip($dest) ;
- ok !defined $result ;
-
- # corrupt header - 1st byte wrong
- my $bad = $keep ;
- substr($bad, 0, 1) = "\xFF" ;
- $ungzip = Compress::Zlib::memGunzip(\$bad) ;
- ok ! defined $ungzip ;
-
- # corrupt header - 2st byte wrong
- $bad = $keep ;
- substr($bad, 1, 1) = "\xFF" ;
- $ungzip = Compress::Zlib::memGunzip(\$bad) ;
- ok ! defined $ungzip ;
-
- # corrupt header - method not deflated
- $bad = $keep ;
- substr($bad, 2, 1) = "\xFF" ;
- $ungzip = Compress::Zlib::memGunzip(\$bad) ;
- ok ! defined $ungzip ;
-
- # corrupt header - reserverd bits used
- $bad = $keep ;
- substr($bad, 3, 1) = "\xFF" ;
- $ungzip = Compress::Zlib::memGunzip(\$bad) ;
- ok ! defined $ungzip ;
-
- # corrupt trailer - length wrong
- $bad = $keep ;
- substr($bad, -8, 4) = "\xFF" x 4 ;
- $ungzip = Compress::Zlib::memGunzip(\$bad) ;
- ok ! defined $ungzip ;
-
- # corrupt trailer - CRC wrong
- $bad = $keep ;
- substr($bad, -4, 4) = "\xFF" x 4 ;
- $ungzip = Compress::Zlib::memGunzip(\$bad) ;
- ok ! defined $ungzip ;
-}
-
-{
- title "Check all bytes can be handled";
-
- my $lex = new LexFile my $name ;
- my $data = join '', map { chr } 0x00 .. 0xFF;
- $data .= "\r\nabd\r\n";
-
- my $fil;
- ok $fil = gzopen($name, "wb") ;
- is $fil->gzwrite($data), length $data ;
- ok ! $fil->gzclose();
-
- my $input;
- ok $fil = gzopen($name, "rb") ;
- is $fil->gzread($input), length $data ;
- ok ! $fil->gzclose();
- ok $input eq $data;
-
- title "Check all bytes can be handled - transparent mode";
- writeFile($name, $data);
- ok $fil = gzopen($name, "rb") ;
- is $fil->gzread($input), length $data ;
- ok ! $fil->gzclose();
- ok $input eq $data;
-
-}
-
-title 'memGunzip with a gzopen created file';
-{
- my $name = "test.gz" ;
- my $buffer = <<EOM;
-some sample
-text
-
-EOM
-
- ok $fil = gzopen($name, "wb") ;
-
- ok $fil->gzwrite($buffer) == length $buffer ;
-
- ok ! $fil->gzclose ;
-
- my $compr = readFile($name);
- ok length $compr ;
- my $unc = Compress::Zlib::memGunzip($compr) ;
- ok defined $unc ;
- ok $buffer eq $unc ;
- 1 while unlink $name ;
-}
-
-{
-
- # Check - MAX_WBITS
- # =================
-
- $hello = "Test test test test test";
- @hello = split('', $hello) ;
-
- ok (($x, $err) = deflateInit( -Bufsize => 1, -WindowBits => -MAX_WBITS() ) ) ;
- ok $x ;
- ok $err == Z_OK ;
-
- $Answer = '';
- foreach (@hello)
- {
- ($X, $status) = $x->deflate($_) ;
- last unless $status == Z_OK ;
-
- $Answer .= $X ;
- }
-
- ok $status == Z_OK ;
-
- ok ((($X, $status) = $x->flush())[1] == Z_OK ) ;
- $Answer .= $X ;
-
-
- @Answer = split('', $Answer) ;
- # Undocumented corner -- extra byte needed to get inflate to return
- # Z_STREAM_END when done.
- push @Answer, " " ;
-
- ok (($k, $err) = inflateInit(-Bufsize => 1, -WindowBits => -MAX_WBITS()) ) ;
- ok $k ;
- ok $err == Z_OK ;
-
- $GOT = '';
- foreach (@Answer)
- {
- ($Z, $status) = $k->inflate($_) ;
- $GOT .= $Z ;
- last if $status == Z_STREAM_END or $status != Z_OK ;
-
- }
-
- ok $status == Z_STREAM_END ;
- ok $GOT eq $hello ;
-
-}
-
-{
- # inflateSync
-
- # create a deflate stream with flush points
-
- my $hello = "I am a HAL 9000 computer" x 2001 ;
- my $goodbye = "Will I dream?" x 2010;
- my ($err, $answer, $X, $status, $Answer);
-
- ok (($x, $err) = deflateInit() ) ;
- ok $x ;
- ok $err == Z_OK ;
-
- ($Answer, $status) = $x->deflate($hello) ;
- ok $status == Z_OK ;
-
- # create a flush point
- ok ((($X, $status) = $x->flush(Z_FULL_FLUSH))[1] == Z_OK ) ;
- $Answer .= $X ;
-
- ($X, $status) = $x->deflate($goodbye) ;
- ok $status == Z_OK ;
- $Answer .= $X ;
-
- ok ((($X, $status) = $x->flush())[1] == Z_OK ) ;
- $Answer .= $X ;
-
- my ($first, @Answer) = split('', $Answer) ;
-
- my $k;
- ok (($k, $err) = inflateInit()) ;
- ok $k ;
- ok $err == Z_OK ;
-
- ($Z, $status) = $k->inflate($first) ;
- ok $status == Z_OK ;
-
- # skip to the first flush point.
- while (@Answer)
- {
- my $byte = shift @Answer;
- $status = $k->inflateSync($byte) ;
- last unless $status == Z_DATA_ERROR;
-
- }
-
- ok $status == Z_OK;
-
- my $GOT = '';
- my $Z = '';
- foreach (@Answer)
- {
- my $Z = '';
- ($Z, $status) = $k->inflate($_) ;
- $GOT .= $Z if defined $Z ;
- # print "x $status\n";
- last if $status == Z_STREAM_END or $status != Z_OK ;
-
- }
-
- # zlib 1.0.9 returns Z_STREAM_END here, all others return Z_DATA_ERROR
- ok $status == Z_DATA_ERROR || $status == Z_STREAM_END ;
- ok $GOT eq $goodbye ;
-
-
- # Check inflateSync leaves good data in buffer
- $Answer =~ /^(.)(.*)$/ ;
- my ($initial, $rest) = ($1, $2);
-
-
- ok (($k, $err) = inflateInit()) ;
- ok $k ;
- ok $err == Z_OK ;
-
- ($Z, $status) = $k->inflate($initial) ;
- ok $status == Z_OK ;
-
- $status = $k->inflateSync($rest) ;
- ok $status == Z_OK;
-
- ($GOT, $status) = $k->inflate($rest) ;
-
- ok $status == Z_DATA_ERROR ;
- ok $Z . $GOT eq $goodbye ;
-}
-
-{
- # deflateParams
-
- my $hello = "I am a HAL 9000 computer" x 2001 ;
- my $goodbye = "Will I dream?" x 2010;
- my ($input, $err, $answer, $X, $status, $Answer);
-
- ok (($x, $err) = deflateInit(-Level => Z_BEST_COMPRESSION,
- -Strategy => Z_DEFAULT_STRATEGY) ) ;
- ok $x ;
- ok $err == Z_OK ;
-
- ok $x->get_Level() == Z_BEST_COMPRESSION;
- ok $x->get_Strategy() == Z_DEFAULT_STRATEGY;
-
- ($Answer, $status) = $x->deflate($hello) ;
- ok $status == Z_OK ;
- $input .= $hello;
-
- # error cases
- eval { $x->deflateParams() };
- #like $@, mkErr("^Compress::Raw::Zlib::deflateParams needs Level and/or Strategy");
- like $@, "/^Compress::Raw::Zlib::deflateParams needs Level and/or Strategy/";
-
- eval { $x->deflateParams(-Joe => 3) };
- like $@, "/^Compress::Raw::Zlib::deflateStream::deflateParams: unknown key value/";
- #like $@, mkErr("^Compress::Raw::Zlib::deflateStream::deflateParams: unknown key value(s) Joe");
- #ok $@ =~ /^Compress::Zlib::deflateStream::deflateParams: unknown key value\(s\) Joe at/
- # or print "# $@\n" ;
-
- ok $x->get_Level() == Z_BEST_COMPRESSION;
- ok $x->get_Strategy() == Z_DEFAULT_STRATEGY;
-
- # change both Level & Strategy
- $status = $x->deflateParams(-Level => Z_BEST_SPEED, -Strategy => Z_HUFFMAN_ONLY) ;
- ok $status == Z_OK ;
-
- ok $x->get_Level() == Z_BEST_SPEED;
- ok $x->get_Strategy() == Z_HUFFMAN_ONLY;
-
- ($X, $status) = $x->deflate($goodbye) ;
- ok $status == Z_OK ;
- $Answer .= $X ;
- $input .= $goodbye;
-
- # change only Level
- $status = $x->deflateParams(-Level => Z_NO_COMPRESSION) ;
- ok $status == Z_OK ;
-
- ok $x->get_Level() == Z_NO_COMPRESSION;
- ok $x->get_Strategy() == Z_HUFFMAN_ONLY;
-
- ($X, $status) = $x->deflate($goodbye) ;
- ok $status == Z_OK ;
- $Answer .= $X ;
- $input .= $goodbye;
-
- # change only Strategy
- $status = $x->deflateParams(-Strategy => Z_FILTERED) ;
- ok $status == Z_OK ;
-
- ok $x->get_Level() == Z_NO_COMPRESSION;
- ok $x->get_Strategy() == Z_FILTERED;
-
- ($X, $status) = $x->deflate($goodbye) ;
- ok $status == Z_OK ;
- $Answer .= $X ;
- $input .= $goodbye;
-
- ok ((($X, $status) = $x->flush())[1] == Z_OK ) ;
- $Answer .= $X ;
-
- my ($first, @Answer) = split('', $Answer) ;
-
- my $k;
- ok (($k, $err) = inflateInit()) ;
- ok $k ;
- ok $err == Z_OK ;
-
- ($Z, $status) = $k->inflate($Answer) ;
-
- ok $status == Z_STREAM_END
- or print "# status $status\n";
- ok $Z eq $input ;
-}
-
-{
- # error cases
-
- eval { deflateInit(-Level) };
- like $@, '/^Compress::Zlib::deflateInit: Expected even number of parameters, got 1/';
-
- eval { inflateInit(-Level) };
- like $@, '/^Compress::Zlib::inflateInit: Expected even number of parameters, got 1/';
-
- eval { deflateInit(-Joe => 1) };
- ok $@ =~ /^Compress::Zlib::deflateInit: unknown key value\(s\) Joe at/;
-
- eval { inflateInit(-Joe => 1) };
- ok $@ =~ /^Compress::Zlib::inflateInit: unknown key value\(s\) Joe at/;
-
- eval { deflateInit(-Bufsize => 0) };
- ok $@ =~ /^.*?: Bufsize must be >= 1, you specified 0 at/;
-
- eval { inflateInit(-Bufsize => 0) };
- ok $@ =~ /^.*?: Bufsize must be >= 1, you specified 0 at/;
-
- eval { deflateInit(-Bufsize => -1) };
- #ok $@ =~ /^.*?: Bufsize must be >= 1, you specified -1 at/;
- ok $@ =~ /^Compress::Zlib::deflateInit: Parameter 'Bufsize' must be an unsigned int, got '-1'/;
-
- eval { inflateInit(-Bufsize => -1) };
- ok $@ =~ /^Compress::Zlib::inflateInit: Parameter 'Bufsize' must be an unsigned int, got '-1'/;
-
- eval { deflateInit(-Bufsize => "xxx") };
- ok $@ =~ /^Compress::Zlib::deflateInit: Parameter 'Bufsize' must be an unsigned int, got 'xxx'/;
-
- eval { inflateInit(-Bufsize => "xxx") };
- ok $@ =~ /^Compress::Zlib::inflateInit: Parameter 'Bufsize' must be an unsigned int, got 'xxx'/;
-
- eval { gzopen([], 0) ; } ;
- ok $@ =~ /^gzopen: file parameter is not a filehandle or filename at/
- or print "# $@\n" ;
-
-# my $x = Symbol::gensym() ;
-# eval { gzopen($x, 0) ; } ;
-# ok $@ =~ /^gzopen: file parameter is not a filehandle or filename at/
-# or print "# $@\n" ;
-
-}
-
-if ($] >= 5.005)
-{
- # test inflate with a substr
-
- ok my $x = deflateInit() ;
-
- ok ((my ($X, $status) = $x->deflate($contents))[1] == Z_OK) ;
-
- my $Y = $X ;
-
-
-
- ok ((($X, $status) = $x->flush() )[1] == Z_OK ) ;
- $Y .= $X ;
-
- my $append = "Appended" ;
- $Y .= $append ;
-
- ok $k = inflateInit() ;
-
- #($Z, $status) = $k->inflate(substr($Y, 0, -1)) ;
- ($Z, $status) = $k->inflate(substr($Y, 0)) ;
-
- ok $status == Z_STREAM_END ;
- ok $contents eq $Z ;
- is $Y, $append;
-
-}
-
-if ($] >= 5.005)
-{
- # deflate/inflate in scalar context
-
- ok my $x = deflateInit() ;
-
- my $X = $x->deflate($contents);
-
- my $Y = $X ;
-
-
-
- $X = $x->flush();
- $Y .= $X ;
-
- my $append = "Appended" ;
- $Y .= $append ;
-
- ok $k = inflateInit() ;
-
- $Z = $k->inflate(substr($Y, 0, -1)) ;
- #$Z = $k->inflate(substr($Y, 0)) ;
-
- ok $contents eq $Z ;
- is $Y, $append;
-
-}
-
-{
- title 'CRC32' ;
-
- # CRC32 of this data should have the high bit set
- # value in ascii is ZgRNtjgSUW
- my $data = "\x5a\x67\x52\x4e\x74\x6a\x67\x53\x55\x57";
- my $expected_crc = 0xCF707A2B ; # 3480255019
-
- my $crc = crc32($data) ;
- is $crc, $expected_crc;
-}
-
-{
- title 'Adler32' ;
-
- # adler of this data should have the high bit set
- # value in ascii is lpscOVsAJiUfNComkOfWYBcPhHZ[bT
- my $data = "\x6c\x70\x73\x63\x4f\x56\x73\x41\x4a\x69\x55\x66" .
- "\x4e\x43\x6f\x6d\x6b\x4f\x66\x57\x59\x42\x63\x50" .
- "\x68\x48\x5a\x5b\x62\x54";
- my $expected_crc = 0xAAD60AC7 ; # 2866154183
- my $crc = adler32($data) ;
- is $crc, $expected_crc;
-}
-
-{
- # memGunzip - input > 4K
-
- my $contents = '' ;
- foreach (1 .. 20000)
- { $contents .= chr int rand 256 }
-
- ok my $compressed = Compress::Zlib::memGzip(\$contents) ;
-
- ok length $compressed > 4096 ;
- ok my $out = Compress::Zlib::memGunzip(\$compressed) ;
-
- ok $contents eq $out ;
- is length $out, length $contents ;
-
-
-}
-
-
-{
- # memGunzip Header Corruption Tests
-
- my $string = <<EOM;
-some text
-EOM
-
- my $good ;
- ok my $x = new IO::Compress::Gzip \$good, Append => 1, -HeaderCRC => 1 ;
- ok $x->write($string) ;
- ok $x->close ;
-
- {
- title "Header Corruption - Fingerprint wrong 1st byte" ;
- my $buffer = $good ;
- substr($buffer, 0, 1) = 'x' ;
-
- ok ! Compress::Zlib::memGunzip(\$buffer) ;
- }
-
- {
- title "Header Corruption - Fingerprint wrong 2nd byte" ;
- my $buffer = $good ;
- substr($buffer, 1, 1) = "\xFF" ;
-
- ok ! Compress::Zlib::memGunzip(\$buffer) ;
- }
-
- {
- title "Header Corruption - CM not 8";
- my $buffer = $good ;
- substr($buffer, 2, 1) = 'x' ;
-
- ok ! Compress::Zlib::memGunzip(\$buffer) ;
- }
-
- {
- title "Header Corruption - Use of Reserved Flags";
- my $buffer = $good ;
- substr($buffer, 3, 1) = "\xff";
-
- ok ! Compress::Zlib::memGunzip(\$buffer) ;
- }
-
-}
-
-for my $index ( GZIP_MIN_HEADER_SIZE + 1 .. GZIP_MIN_HEADER_SIZE + GZIP_FEXTRA_HEADER_SIZE + 1)
-{
- title "Header Corruption - Truncated in Extra";
- my $string = <<EOM;
-some text
-EOM
-
- my $truncated ;
- ok my $x = new IO::Compress::Gzip \$truncated, Append => 1, -HeaderCRC => 1, Strict => 0,
- -ExtraField => "hello" x 10 ;
- ok $x->write($string) ;
- ok $x->close ;
-
- substr($truncated, $index) = '' ;
-
- ok ! Compress::Zlib::memGunzip(\$truncated) ;
-
-
-}
-
-my $Name = "fred" ;
-for my $index ( GZIP_MIN_HEADER_SIZE .. GZIP_MIN_HEADER_SIZE + length($Name) -1)
-{
- title "Header Corruption - Truncated in Name";
- my $string = <<EOM;
-some text
-EOM
-
- my $truncated ;
- ok my $x = new IO::Compress::Gzip \$truncated, Append => 1, -Name => $Name;
- ok $x->write($string) ;
- ok $x->close ;
-
- substr($truncated, $index) = '' ;
-
- ok ! Compress::Zlib::memGunzip(\$truncated) ;
-}
-
-my $Comment = "comment" ;
-for my $index ( GZIP_MIN_HEADER_SIZE .. GZIP_MIN_HEADER_SIZE + length($Comment) -1)
-{
- title "Header Corruption - Truncated in Comment";
- my $string = <<EOM;
-some text
-EOM
-
- my $truncated ;
- ok my $x = new IO::Compress::Gzip \$truncated, -Comment => $Comment;
- ok $x->write($string) ;
- ok $x->close ;
-
- substr($truncated, $index) = '' ;
- ok ! Compress::Zlib::memGunzip(\$truncated) ;
-}
-
-for my $index ( GZIP_MIN_HEADER_SIZE .. GZIP_MIN_HEADER_SIZE + GZIP_FHCRC_SIZE -1)
-{
- title "Header Corruption - Truncated in CRC";
- my $string = <<EOM;
-some text
-EOM
-
- my $truncated ;
- ok my $x = new IO::Compress::Gzip \$truncated, -HeaderCRC => 1;
- ok $x->write($string) ;
- ok $x->close ;
-
- substr($truncated, $index) = '' ;
-
- ok ! Compress::Zlib::memGunzip(\$truncated) ;
-}
-
-{
- title "memGunzip can cope with a gzip header with all possible fields";
- my $string = <<EOM;
-some text
-EOM
-
- my $buffer ;
- ok my $x = new IO::Compress::Gzip \$buffer,
- -Append => 1,
- -Strict => 0,
- -HeaderCRC => 1,
- -Name => "Fred",
- -ExtraField => "Extra",
- -Comment => 'Comment';
- ok $x->write($string) ;
- ok $x->close ;
-
- ok defined $buffer ;
-
- ok my $got = Compress::Zlib::memGunzip($buffer)
- or diag "gzerrno is $gzerrno" ;
- is $got, $string ;
-}
-
-
-{
- # Trailer Corruption tests
-
- my $string = <<EOM;
-some text
-EOM
-
- my $good ;
- ok my $x = new IO::Compress::Gzip \$good, Append => 1 ;
- ok $x->write($string) ;
- ok $x->close ;
-
- foreach my $trim (-8 .. -1)
- {
- my $got = $trim + 8 ;
- title "Trailer Corruption - Trailer truncated to $got bytes" ;
- my $buffer = $good ;
-
- substr($buffer, $trim) = '';
-
- ok my $u = Compress::Zlib::memGunzip(\$buffer) ;
- ok $u eq $string;
-
- }
-
- {
- title "Trailer Corruption - Length Wrong, CRC Correct" ;
- my $buffer = $good ;
- substr($buffer, -4, 4) = pack('V', 1234);
-
- ok ! Compress::Zlib::memGunzip(\$buffer) ;
- }
-
- {
- title "Trailer Corruption - Length Wrong, CRC Wrong" ;
- my $buffer = $good ;
- substr($buffer, -4, 4) = pack('V', 1234);
- substr($buffer, -8, 4) = pack('V', 1234);
-
- ok ! Compress::Zlib::memGunzip(\$buffer) ;
-
- }
-}
-
-
-sub slurp
-{
- my $name = shift ;
-
- my $input;
- my $fil = gzopen($name, "rb") ;
- ok $fil , "opened $name";
- cmp_ok $fil->gzread($input, 50000), ">", 0, "read more than zero bytes";
- ok ! $fil->gzclose(), "closed ok";
-
- return $input;
-}
-
-sub trickle
-{
- my $name = shift ;
-
- my $got;
- my $input;
- $fil = gzopen($name, "rb") ;
- ok $fil, "opened ok";
- while ($fil->gzread($input, 50000) > 0)
- {
- $got .= $input;
- $input = '';
- }
- ok ! $fil->gzclose(), "closed ok";
-
- return $got;
-
- return $input;
-}
-
-{
-
- title "Append & MultiStream Tests";
- # rt.24041
-
- my $lex = new LexFile my $name ;
- my $data1 = "the is the first";
- my $data2 = "and this is the second";
- my $trailing = "some trailing data";
-
- my $fil;
-
- title "One file";
- $fil = gzopen($name, "wb") ;
- ok $fil, "opened first file";
- is $fil->gzwrite($data1), length $data1, "write data1" ;
- ok ! $fil->gzclose(), "Closed";
-
- is slurp($name), $data1, "got expected data from slurp";
- is trickle($name), $data1, "got expected data from trickle";
-
- title "Two files";
- $fil = gzopen($name, "ab") ;
- ok $fil, "opened second file";
- is $fil->gzwrite($data2), length $data2, "write data2" ;
- ok ! $fil->gzclose(), "Closed";
-
- is slurp($name), $data1 . $data2, "got expected data from slurp";
- is trickle($name), $data1 . $data2, "got expected data from trickle";
-
- title "Trailing Data";
- open F, ">>$name";
- print F $trailing;
- close F;
-
- is slurp($name), $data1 . $data2 . $trailing, "got expected data from slurp" ;
- is trickle($name), $data1 . $data2 . $trailing, "got expected data from trickle" ;
-}
-
-{
- title "gzclose & gzflush return codes";
- # rt.29215
-
- my $lex = new LexFile my $name ;
- my $data1 = "the is some text";
- my $status;
-
- $fil = gzopen($name, "wb") ;
- ok $fil, "opened first file";
- is $fil->gzwrite($data1), length $data1, "write data1" ;
- $status = $fil->gzflush(0xfff);
- ok $status, "flush not ok" ;
- is $status, Z_STREAM_ERROR;
- ok ! $fil->gzflush(), "flush ok" ;
- ok ! $fil->gzclose(), "Closed";
-}
--- /dev/null
+CHANGES
+-------
+
+ 2.017 22 February 2009
+
+ * TODO - mention LimitOutput
+
+ * Merged IO-Compress-Base, IO-Compress-Bzip2, IO-Compress-Zlib &
+ Compress-Zlib into IO-Compress.
+
+ * IO::Compress::Base & IO::Uncompress::Base
+ Downgraded some croaks in the constructors to just set $! (by letting
+ the code attempt to open a file and fail).
+ This makes the behavior more consistent to a standard open.
+ [RT #42657]
+
+ * IO::Uncompress::Base
+ Doing a seek with MultiStream could drop some of the uncompressed
+ data. Fixed.
+
+ * IO::Compress::Zip
+ - Fixed problem with the uncompressed & uncompressed fields when
+ zip64 is enabled. They were set to 0x0000FFFF instead of
+ 0xFFFFFFFF. Also the ZIP64 extra field was 4 bytes short.
+ Problem spotted by Dino Chiesa.
+
+ * Compress::Zlib
+ - Documented Compress::Zlib::zlib_version()
+
+
+ 2.015 3 September 2008
+
+ * Makefile.PL
+ Backout changes made in 2.014
+
+ 2.014 2 September 2008
+
+ * Makefile.PL
+ Updated to check for indirect dependencies.
+
+ 2.013 18 July 2008
+
+ * IO::Compress::Base
+ - Allow IO::Compress::Base::Parameters::parse to accept an
+ IO::Compress::Base::Parameters object.
+
+ 2.012 15 July 2008
+
+ * IO::Compress::Base
+ - Silenced an uninitialised value warning when reading a line
+ at a time from a zip file where the content uses ZIP_CM_STORE.
+ [Problem spotted & fixed by Jeff Holt]
+
+ * IO::Compress::Base & IO::Uncompress::Base
+ - local-ise $!, $? et al in the DESTROY methods.
+
+ 2.011 17 May 2008
+
+ * IO::Compress::Base
+ - Fixed problem that prevented the creation of a zip file that
+ contained more than one compression method.
+
+ * IO::Compress::Base::Common
+ - The private Validator class in this module clashes with another
+ CPAN module. Moved Validator into the IO::Compress::Base::Common
+ namespace.
+ [RT #35954]
+
+ * IO::Uncompress::Unzip
+ - Print an error message if the zip file contains a
+ member compressed with bzip2 and IO::Uncompress::Bunzip2 is
+ not available.
+ - Could not cope with mixed compression zip files. For example a
+ zip file that contains both STORED and DEFLATED content.
+ [RT #35573]
+
+ 2.010 5 May 2008
+
+ * Fixed problem that meant Perl 5.10 could not upgrade this module.
+ [RT #35342 & 35341]
+
+ 2.009 20 April 2008
+
+ * Removed the alpha status from File::GlobMapper
+
+ * IO::Compress::Base
+ When writing output never output a zero length buffer.
+ Done to improve interoperability with other tied filenandle
+ modules.
+
+ * Changed IO::Uncompress::Base to not use the offset parameter of
+ the read method when reading from a filehandle.
+
+ The object returned from Net::FTP::retr implements a non-standard
+ read method. The third parameter is used for a timeout value
+ rather than an offset.
+ [rt.cpan#33231]
+
+ * Changed IO::Uncompress::Base to not use the eof method when
+ reading from a filehandle.
+
+ The object returned from Net::FTP::retr implements both the read
+ method and the eof method. Unfortunately the implementation of
+ the read method uses non-buffered IO (by using sysread) while
+ the eof method uses buffered IO. Mixing buffered and non-buffered
+ IO results in data corruption.
+
+ * IO::Compress::Zip
+
+ - Added exUnix2 option to allow storing of UID & GID.
+ - When running on a Unix derivative the ExtAttr option now defaults
+ to the equivalent of 0666. For all other systems the default
+ remains 0.
+
+ * Compress::Zlib
+ - Minor documentation issue with flush.
+ [rt.cpan.org #31446]
+
+
+ 2.008 2 November 2007
+
+ * Minor documentation changes in README
+
+ * t/compress/truncate.pl
+ EBCDIC Cleanup.
+
+ * IO::Compress::Gzip::Constants.pm
+ Tidied up the character classes used to defined invalid
+ FNAME & FCOMMENT fields for EBCDIC.
+
+ * Compress::Zlib
+ lib/Compress/Zlib.pm -- 1.x Backward Compatability issues
+ gzclose - documented return value was wrong, should be 0 for ok.
+ gzflush - return value didn't match 1.x, should return 0 if ok.
+ [rt.cpan.org #29215] and Debian bug #440943 http://bugs.debian.org/440943
+
+ 2.006 1 September 20007
+
+ * Makefile.PL
+ Added INSTALLDIRS directive to install as a core module when built
+ on a perl >= 5.9.
+
+ * IO::Uncompress::RawDeflate
+
+ - Fixed export problem - "$RawDeflateError" and "rawdeflate" were
+ not being exported with ":all".
+
+ * Compress::Zlib
+ - t/03zlib-v1.t
+ Fixed crc32 and adler32 tests in to remove ascii assumption.
+
+ - lib/Compress/Zlib.pm
+ Make gzreadline not support $/, just like in Compress::Zlib 1.x
+ Folk who want $/ with readline support can get it in
+ IO::Uncompress::Gunzip. [rt.cpan.org #28663] and
+ Debian bug #435656 http://bugs.debian.org/435656
+
+
+ 2.005 18 June 2007
+
+ * Stephen Turner reported a problem when using IO::Uncompress::Gunzip
+ with XML::Parser. Turns out there were two issues.
+
+ Firstly an IO::Uncompress object isn't an IO::Handle. It is now.
+
+ Secondly the implementation of "read" wasn't honouring this
+
+ SCALAR will be grown or shrunk to the length actually read.
+
+ In particular it didn't do the right thing on EOF.
+ This has been fixed.
+
+ * IO::Compress::Gzip & IO::Uncompress::Gunzip
+
+ - RFC1952 says that the FNAME & FCOMMENT header fields must be ISO
+ 8859-1 (LATIN-1) characters. The code can optionally police this.
+ Added a fix for this logic when running on EBCDIC.
+
+ * Compress::Zlib
+ Added info about removing Compress::Zlib version 1, before
+ installing version 2.
+
+ 2.004 3 March 2007
+
+ * Made seek less wasteful of memory.
+
+ * IO::Compress::Zip
+
+ - Added Zip64 documentation.
+
+ - Fixed extended timestamp.
+ Creation time isn't available in Unix so only store the
+ modification time and the last access time in the extended field.
+
+ - Fixed file mode.
+
+ - Added ExtAttr option to control the value of the "external file
+ attributes" field in the central directory.
+
+ - Added Unix2 extended attribute ("Ux").
+ This stores the UID & GID.
+
+ * IO::Compress::Gzip
+
+ - Fixed 050interop-gzip.t for Windows
+
+ * IO::Compress::Bzip2
+
+ - Fixed 050interop-bzip2.t for Windows
+
+ * Compress::Zlib
+
+ - rewrote memGzip using IO::Compress::Gzip::gzip
+
+ 2.003 2 January 2007
+
+ * Added explicit version checking
+
+ 2.002 29 December 2006
+
+ * Documentation updates.
+
+ * Added IO::Handle to the ISA test in isaFilehandle
+
+ * Add an explicit use_ok test for Scalar::Util in the test harness.
+ The error message reported by 01misc implied the problem was
+ somewhere else.
+ Also explictly check that 'dualvar' is available.
+
+ * Compress::Zlib
+ - Fix append mode with gzopen.
+ rt-cpan.org 24041
+
+ - Allow gzopen to read from and write to a scalar reference.
+
+ 2.001 1 November 2006
+
+ * Remove beta status.
+
+ 2.000_14 26 October 2006
+
+ * IO::Uncompress::Base
+ Added support for $/ in record mode
+
+ * IO::Uncompress::Base
+ The readline interface was substantially slower than the 1.x
+ equivalent. This has now been sorted.
+ Thanks to Andreas J. Koenig for spotting the problem.
+
+ * IO::Uncompress::AnyUncompress
+ Added IO::Uncompress::Lzf to the list of supported uncompresors.
+
+ * IO::Uncompress::Base
+ Added TrailingData to one-shot interface.
+
+ * IO::Uncompress::AnyUncompress
+ Remove raw-deflate (RFC1951) from the default list of compressors
+ to check.
+ It can still be included if the new RawInflate parameter is
+ supplied.
+ This change was made because the only way to tell if content is
+ raw-deflate is to attempt to uncompress it - a few false positives
+ have popped up recently, which suggests that auto-detecting raw
+ deflate is far from perfect.
+ The equivalent change has been made to IO::Uncompress::AnyInflate.
+ [Core patch #28445]
+
+ * Don't check that filehandles are writable. It would seem that
+ "-w *STDOUT" on windows returns false.
+ [Core Patch #28415]
+
+ * IO::Uncompress::Deflate
+ Beefed up the magic signature check. Means less false positives
+ when auto-detecting the compression type.
+
+ * IO::Uncompress::UnZip
+ Tighten up the zip64 extra field processing to cope with the case
+ wheere only some of the local header fields are superceeded.
+
+ * IO::Uncompress::AnyInflate
+ Remove raw-deflate (RFC 1951) from the default list of compressors
+ to check.
+ It can still be included if the new RawInflate parameter is
+ supplied.
+ This change was made because the only way to tell if content is
+ raw-deflate is to attempt to uncompress it - a few false positives
+ have popped up recently, which suggests that auto-detecting raw
+ deflate is far from perfect.
+ The equivalent change has been made to IO::Uncompress::AnyUncompress.
+ [Core patch #28445]
+
+ 2.000_13 20 June 2006
+
+ * Store compress & uncompressed sizes as 64-bit.
+
+ * For one-shot uncompression, like this
+
+ unzip "some.zip" => \@a, MultiStream => 1;
+
+ Push each uncompressed stream from "some.zip" onto @a.
+
+ * Added IO::Compress::Base::FilterEnvelope
+
+ * Added IO::Uncompress::Base::nextStream
+
+ * The '-' filehandle now maps to either *STDIN or *STDOUT.
+ This keeps mod_perl happier. Was using these before
+
+ new IO::File("<-")
+ new IO::File(">-")
+
+ * Preliminary support for reading zip files with zip64 members.
+
+ 2.000_12 3 May 2006
+
+ * Moved the code for creating and parsing the gzip extra field into
+ IO::Compress::Zlib::Extra.pm so that IO::Compress::Zip &
+ IO::Uncompress::Unzip can use it as well.
+
+ * Added ExtraFieldLocal & ExtraFieldCentral options to IO::Compress::Zip.
+ These allow the creation of user-defined extra fields in the local
+ and central headers, just like the ExtraField option in
+ IO::Compress::Gzip.
+
+ * Moved the zip constants into IO::Compress::Zip::Constants
+
+ * Added exTime option to IO::Compress::Zip.
+ This allows creation of the extended timestamp extra field.
+
+ * Added Minimal option to IO::Compress::Zip.
+ This disables the creation of all extended fields.
+
+ * Added TextFlag option to IO::Compress::Zip.
+
+ * Documented Comment and ZipComment options in IO::Compress::Zip.
+
+ * Compress::Zlib
+ Fixed gzread to zap the output buffer to an empty string when zero
+ bytes are requested. This matches the behaviour of C::Z 1.x
+
+ 2.000_11 10 April 2006
+
+ * Transparent + InputLength made more robust where input data is not
+ compressed.
+
+ * Updated Documentation for zip modules.
+
+ * Changed IO::Compress::Zip 'Store' option to 'Method' and added
+ symbolic constants ZIP_CM_STORE, ZIP_CM_DEFLATE and ZIP_CM_BZIP2 to
+ allow the compression method to be picked by the user.
+
+ * Added support to allow bzip2 compressed data to be written/read
+ with IO::Compress::Zip and IO::Uncompress::Unzip.
+
+ * Beefed up 050interop-gzip.t to check that the external gzip command
+ works as expected before starting the tests. This means that
+ this test harness will just be skipped on problematic systems.
+
+ * Merged core patch 27565 from Steve Peters. This works around a
+ problem with gzip on OpenBSD where it doesn't seem to like
+ compressing files < 10 bytes long.
+
+ * Beefed up 050interop-bzip2.t to check that the external bzip2 command
+ works as expected before starting the tests. This means that
+ this test harness will just be skipped on problematic systems.
+
+ 2.000_10 13 March 2006
+
+ * AnyUncompress doesn't assume that IO-Compress-Zlib is installed any
+ more.
+
+ * Documentation updates.
+
+ * Compress::Zlib
+ Changed gzread so that its behaviour matches C::Z::gzread 1.x if it
+ is called after eof. In this case it will write an empty string
+ into the output parameter. This change is solely for backward
+ compatability reasons.
+
+ 2.000_09 3 March 2006
+
+ * Released to CPAN.
+
+ 2.000_08 2 March 2006
+
+ * Split IO::Compress::Base into its own distribution.
+
+ * Split IO::Compress::Bzip2 into its own distribution.
+
+ * Added opened, autoflush and input_line_number.
+
+ * Beefed up support for $.
+
+ * Split IO::Compress::Zlib into its own distribution.
+
+ * Beefed up support for zip/unzip
+
+ * Breakout zlib specific code into separate modules.
+
+ * Limited support for reading/writing zip files
+
+ 2.000_06 5 October 2005
+
+ * Added eof parameter to Compress::Zlib::inflate method.
+
+ * Fixed issue with 64-bit
+
+ 2.000_05 4 October 2005
+
+ * Renamed IO::* to IO::Compress::* & IO::Uncompress::*
+
+ 2.000_04 23 September 2005
+
+ * Fixed some more non-portable test that were failing on VMS.
+
+ * fixed problem where error messages in the oneshot interface were
+ getting lost.
+
+ 2.000_03 12 September 2005
+
+ * Fixed some non-portable test that were failing on VMS.
+
+ * Fixed export of zlib constants from the IO::* classes
+
+ 2.000_02 6 September 2005
+
+ * Split Append mode into Append and Merge
+
+ * Fixed typos in the documentation.
+
+ * Added pod/FAQ.pod
+
+ * Added libscan to Makefile.PL
+
+ * Added InputLength for IO::Gunzip et al
+
+ 2.000_01 22 August 2005
+
+ * Fixed VERSION in Compress::Gzip::Constants
+
+ * Removed Compress::Gzip::Info from the distribution.
+
+ 2.000_00 21 August 2005
+
+ * First Beta relase of Compress::zlib rewrite.
+
+Compress-Zlib version 1 Changes
+
+ 1.38 - 6 September 2005
+
+ * Integrate core change 25304 -- Symbian Update
+
+ * Added libscan to Makefile.PL
+
+ 1.37 - 12 August 2005
+
+ * Change to t/03examples.t for VMS from Abe Timmerman
+
+ 1.36 - 3 August 2005
+
+ * Renamed zlib-src-1.2.3 to zlib-src to help VMS
+
+ * Fixed Makefile.PL for VMS
+
+ * Fixed t/03examples.t for VMS
+
+ * Added a couple of notes about incompatibility with Unix compress.
+
+ 1.35 - 16 July 2005
+
+ * Updated zlib source to 1.2.3
+
+ * Fixed problem with where two calls to gzclose would hang the debugger.
+ See https://rt.cpan.org/Ticket/Display.html?id=13789
+
+ * Added code from Alexey Tourbin to use XSLoader when available,
+ and DynaLoader otherwise.
+
+ * Documented that the compress & uncompress functions were not
+ the same as the Unix utilities of the same name.
+
+ * Fixed 05gzsetp -- it left a temp file hanging around.
+
+ * Integrate core change 24787 - SvUPGRADE returns void in blead
+
+ * Integrate core change 24788 - Makefile.PL adjustments for the core
+
+
+ 1.34 - 30 January 2005
+
+ * Fixed typo in the README
+
+ * Fixed examples.t on Win32 where paths have embedded whitespace.
+
+ * Fix for Cygwin and core integration from Jos I. Boumans
+
+ * Upgrade zlib source to 1.2.2
+
+ 1.33 - 14 January 2004
+
+ * Reworked Makefile.PL to avoid creating a private copy of zlib.
+ This both simplifies the build, plus it makes life easier for VMS.
+
+ * Patches for Makefile.PL to get it to work on VMS supplied by
+ Craig A. Berry.
+
+ * memGunzip has very slow on FreeBSD. Turns out to be down to
+ the way realloc works on FreeBSD. Changed both inflate & deflate
+ to use exponentially increasing buffer sizes when they need to
+ realloc. Thanks to Peter Jeremy for the lowdown on FreeBSD
+ memory allocation.
+
+ 1.32 - 26 November 2003
+
+ * Steve Hay reported a problem on rt.cpan.org with Windows and
+ MSCV++ 6.0 where the source from the zlib directory was getting
+ installed with the rest of the module.
+ https://rt.cpan.org/Ticket/Display.html?id=1741
+
+ This has been fixed by renaming the "zlib" directory to "zlib-src"
+ thus avoiding a conflict with the name of this Perl module.
+
+ * Fixed a bug in the inflate method where the input buffer is an
+ lvalue (via substr). Problem & solution reported by Salvador Fandiqo.
+
+ * Tightened up the logic in Makefile.PL when BUILD_ZLIB is
+ True. Issue spotted by Ralf S. Engelschall.
+
+ 1.31 - 29 October 2003
+
+ * Reinstated the creation of .bak files - $^I seems to need a
+ backup file on Windows. For OpenVMS, the extenstion _bak is used.
+
+ 1.30 - 28 October 2003
+
+ * Bundled a sub-set of the zlib source with the module and changed
+ the default make behaviour to build with the included zlib source.
+ The previous behaviour of using a pre-built zlib library is
+ still available for those that want it.
+
+ * Added prototypes to the subs in Zlib.pm that didn't already have
+ them. Patch from Ed Avis.
+
+ * No .bak files are created by Makefile.PL any more - this keep
+ distclean much happier. Patch suggested by Ed Avis.
+ This also fixes a similar problem reported by Dr. Martin Zinser
+ on OpenVMS.
+
+ * Documentation for some of the gz functions updated.
+
+ * Format strings modified in DispStream to keep OpenVMS happy.
+ Problem reported by Dr. Martin Zinser.
+
+
+ 1.22 - 17 June 2003
+
+ * Makefile.PL now displays a warning about not installing
+ Compress::Zlib via the CPAN shell.
+
+ * Fix to allow intermingling of gzread & gzreadline - patch
+ supplied by Doug Perham.
+
+ * memGunzip will silently now work if the gzip trailer is
+ missing. Some HTTP Origin Servers seem to leave it out.
+
+ 1.21 - 28 April 2003
+
+ * Tests 148 & 150 from t/02zlib.t were failing on redhat 9.
+
+ * Added a few words about the problems with Mac OS X to the README file.
+
+ 1.20 - 4 April 2003
+
+ * Fixed bug in gzopen where $gzerrno wasn't being set correctly.
+ The symptom was $gzerrno was set to Z_MEM_ERROR although the file
+ was opened ok. If gzopen failed, $gzerrno was being set correctly.
+ This problem wasn't spotted before because the typical test
+ to determine whether gzopen passed or failed was to check its
+ return value.
+
+ 1.19 - 31 October 2002
+
+ * fixed a problem with t/02zlib.t that was failing with redhat 8.
+
+ 1.18 - 24 October 2002
+
+ * fixed a Win32 problem in t/02zlib.t by changing sysread to read.
+
+ * zlib 1.0.5 & older doesn't have gzsetparams & gzeof. Added a new
+ variable to config.in to flag an old version of zlib. Split
+ out the tests for gzsetparams into t/05gzsetp.t
+
+ 1.17 - 23 May 2002
+
+ * Moved the test to check the versions of libz & zlib.h into a separate
+ file and added troubleshooting notes to README.
+
+ * In gzopen, only attempt to call "tell" for normal files.
+
+ * Fixed to work in taint mode.
+
+ * Broke changes out of README into Changes file.
+
+ * Replaced internal use of Z_PARTIAL_FLUSH symbol with Z_SYNC_FLUSH.
+ zlib.h says /* will be removed, use Z_SYNC_FLUSH instead */
+
+ 1.16 - 13 December 2001
+
+ * Fixed bug in Makefile.PL that stopped "perl Makefile.PL PREFIX=..."
+ working.
+
+ 1.15 - 4th December 2001
+
+ * Changes a few types to get the module to build on 64-bit Solaris
+
+ * Changed the up/downgrade logic to default to the older constructs, and
+ to only call a downgrade if specifically requested. Some older versions
+ of Perl were having problems with the in-place edit.
+
+ * added the new XS constant code.
+
+ 1.14 - 27th August 2001
+
+ * Memory overwrite bug fixed in "inflate". Kudos to Rob Simons for
+ reporting the bug and to Anton Berezin for fixing it for me.
+
+ 1.13 - 31st June 2001
+
+ * Make sure config.in is consistant when released.
+
+ 1.12 - 28th April 2001
+
+ * Modified Makefile.PL to only enable the warnings pragma if
+ using perl 5.6.1 or better.
+
+ 1.11 - 17th February 2001
+
+ * Added logic in Makefile.PL to toggle between using $^W and
+ the warnings pragma in the module.
+
+ * The module, the examples & the test harness are now all strict
+ & warnings clean.
+
+ 1.10 - 5th February 2001
+
+ * fixed a bug in memGunzip. Used Z_ERR instead of Z_DATA_ERROR.
+
+ 1.09 - 15th January 2001
+
+ * Silenced a few compiler warnings.
+
+ * Updated zlib home site in README & Zlib.pm to www.info-zip.org
+
+ * Minor typo in Zlib.pm - a link used AUTHORS instead of AUTHOR
+ -- spotted by Frank Martini.
+
+ * Mention Archive::Zip
+
+ * added memGunzip. This is largely based on code provided by Jim Leonard.
+
+ * $deflate->flush can now take an optional parameter. Valid
+ values are Z_NO_FLUSH, Z_PARTIAL_FLUSH, Z_SYNC_FLUSH, Z_FULL_FLUSH
+ and Z_FINISH. The default is Z_FINISH.
+
+ 1.08 - 6 Jan 2000
+
+ * uncompress was clobbering its input parameter. Now it doesn't.
+ This bug was spotted by Deven T. Corzine.
+
+ * If a variable that only ever contained a number was given
+ to compress or deflate, it would not be compressed properly. Now
+ it will be coerced to a string and then compressed. This bug
+ was spotted by Deven T. Corzine.
+
+ 1.07 - 27 Nov 1999
+
+ * ANSI-ified the static functions in Zlib.xs
+
+ * Added the ability to build zlib along with the module.
+ This feature is 90% based on a Makefile provided by Gurusamy
+ Sarathy.
+
+ 1.06 - 20 Sep 1999
+
+ * Fixed a nasty problem where inflate could truncate the data
+ returned. Thanks to Douglas Thomson <dougt@mugc.cc.monash.edu.au>
+ for both spotting the problem and fixing the bug.
+
+ * Added a note about the undocumented features in zlib that are
+ required when accessing zip files.
+
+ * gzclose will now get called automatically when the gzip object is
+ destroyed.
+
+ 1.05 - 3 June 1999
+
+ * Previous release used newSVpvn, which doesn't exist in 5.004_04
+ or earlier. Changed to use newSVpv instead.
+
+ * The module needs Perl 5.004 or better, so updated the version
+ checking in Zlib.pm and Makefile.PL
+
+ 1.04 - 27 May 1999
+
+ * Bug 19990527.001: compress(undef) core dumps -- Fixed.
+
+ 1.03 - 17 Mar 1999
+
+ * Updated to use the new PL_ symbols.
+ Means the module can be built with Perl 5.005_5*
+
+ 1.02 - 31 Jan 1999
+
+ * The return codes for gzread, gzreadline and gzwrite were
+ documented incorrectly as returning a status code.
+
+ * The test harness was missing a "gzclose". This caused problem
+ showed up on an amiga. Thanks to Erik van Roode for reporting
+ this one.
+
+ * Patched zlib.t for OS/2. Thanks to Ilya Zakharevich for the patch.
+
+ 1.01 - 23 Nov 1997
+
+ * A number of fixes to the test suite and the example scripts to
+ allow them to work under win32. All courtesy of Gurusamy
+ Sarathy.
+
+ 1.00 - 14 Nov 1997
+
+ * Fixed crc32 & adler32. They were very broken.
+
+ * The following functions can now take a scalar reference in
+ place of a scalar for their buffer parameters:
+
+ compress
+ uncompress
+ deflate
+ inflate
+ crc32
+ adler32
+
+ This should mean applications that make use of the module don't
+ have to copy large buffers around.
+
+
+ * Normally the inflate method consumes I<all> of the input buffer
+ before returning. The exception to this is when inflate detects
+ the end of the stream (Z_STREAM_END). In this case the input
+ buffer need not be completely consumed. To allow processing of
+ file formats that embed a deflation stream (e.g. zip, gzip),
+ the inflate method now sets the buffer parameter to be what
+ remains after inflation.
+
+ When the return status is Z_STREAM_END, it will be what remains
+ of the buffer (if any) after deflation. When the status is Z_OK
+ it will be an empty string.
+
+ This change means that the buffer parameter must be a lvalue.
+
+ * Fixed crc32 and adler32. They were both very broken.
+
+ * Added the Compress::Zlib::memGzip function.
+
+ 0.5 - Confirmed that no changes were necessary for zlib 1.0.3, or 1.0.4.
+
+ The optional parameters for deflateInit and inflateInit can now
+ be specified as an associative array in addition to a reference
+ to an associative array. They can also accept the -Name
+ syntax.
+
+ gzopen can now optionally take a reference to an open
+ filehandle in place of a filename. In this case it will call
+ gzdopen.
+
+ Added gzstream example script.
+
+ 0.4 - Upgrade to support zlib 0.99
+
+ Added dictionary interface.
+
+ Fixed bug in gzreadline - previously it would keep returning
+ the same buffer. This bug was reported by Helmut Jarausch
+
+ Removed dependency to zutil.h and so dropped support for
+
+ DEF_MEM_LEVEL (use MAX_MEM_LEVEL instead)
+ DEF_WBITS (use MAX_WBITS instead)
+
+ 0.3 - Added prototype specification.
+
+ 0.2 - Fixed a minor allocation problem in Zlib.xs
+
+ 0.1 - first alpha release. 2nd October 1995
--- /dev/null
+Changes
+examples/io/anycat
+examples/io/bzip2/bzcat
+examples/io/bzip2/bzgrep
+examples/io/bzip2/bzstream
+examples/io/gzip/gzappend
+examples/io/gzip/gzcat
+examples/io/gzip/gzgrep
+examples/io/gzip/gzstream
+examples/compress-zlib/filtinf
+examples/compress-zlib/filtdef
+examples/compress-zlib/gzcat
+examples/compress-zlib/gzgrep
+examples/compress-zlib/gzstream
+lib/Compress/Zlib.pm
+lib/File/GlobMapper.pm
+lib/IO/Compress/Adapter/Bzip2.pm
+lib/IO/Compress/Adapter/Deflate.pm
+lib/IO/Compress/Adapter/Identity.pm
+lib/IO/Compress/Base/Common.pm
+lib/IO/Compress/Base.pm
+lib/IO/Compress/Bzip2.pm
+lib/IO/Compress/Deflate.pm
+lib/IO/Compress/Gzip/Constants.pm
+lib/IO/Compress/Gzip.pm
+lib/IO/Compress/RawDeflate.pm
+lib/IO/Compress/Zip/Constants.pm
+lib/IO/Compress/Zip.pm
+lib/IO/Compress/Zlib/Constants.pm
+lib/IO/Compress/Zlib/Extra.pm
+lib/IO/Uncompress/Adapter/Bunzip2.pm
+lib/IO/Uncompress/Adapter/Identity.pm
+lib/IO/Uncompress/Adapter/Inflate.pm
+lib/IO/Uncompress/AnyInflate.pm
+lib/IO/Uncompress/AnyUncompress.pm
+lib/IO/Uncompress/Base.pm
+lib/IO/Uncompress/Bunzip2.pm
+lib/IO/Uncompress/Gunzip.pm
+lib/IO/Uncompress/Inflate.pm
+lib/IO/Uncompress/RawInflate.pm
+lib/IO/Uncompress/Unzip.pm
+Makefile.PL
+MANIFEST
+pod/FAQ.pod
+private/MakeUtil.pm
+README
+t/000prereq.t
+t/001bzip2.t
+t/001zlib-generic-deflate.t
+t/001zlib-generic-gzip.t
+t/001zlib-generic-rawdeflate.t
+t/001zlib-generic-zip.t
+t/002any-deflate.t
+t/002any-gzip.t
+t/002any-rawdeflate.t
+t/002any-transparent.t
+t/002any-zip.t
+t/004gziphdr.t
+t/005defhdr.t
+t/006zip.t
+t/010examples-bzip2.t
+t/010examples-zlib.t
+t/01misc.t
+t/020isize.t
+t/050interop-gzip.t
+t/100generic-bzip2.t
+t/100generic-deflate.t
+t/100generic-gzip.t
+t/100generic-rawdeflate.t
+t/100generic-zip.t
+t/101truncate-bzip2.t
+t/101truncate-deflate.t
+t/101truncate-gzip.t
+t/101truncate-rawdeflate.t
+t/101truncate-zip.t
+t/102tied-bzip2.t
+t/102tied-deflate.t
+t/102tied-gzip.t
+t/102tied-rawdeflate.t
+t/102tied-zip.t
+t/103newtied-bzip2.t
+t/103newtied-deflate.t
+t/103newtied-gzip.t
+t/103newtied-rawdeflate.t
+t/103newtied-zip.t
+t/104destroy-bzip2.t
+t/104destroy-deflate.t
+t/104destroy-gzip.t
+t/104destroy-rawdeflate.t
+t/104destroy-zip.t
+t/105oneshot-bzip2.t
+t/105oneshot-deflate.t
+t/105oneshot-gzip-only.t
+t/105oneshot-gzip.t
+t/105oneshot-rawdeflate.t
+t/105oneshot-zip-bzip2-only.t
+t/105oneshot-zip-only.t
+t/105oneshot-zip.t
+t/106prime-bzip2.t
+t/106prime-deflate.t
+t/106prime-gzip.t
+t/106prime-rawdeflate.t
+t/106prime-zip.t
+t/107multi-bzip2.t
+t/107multi-deflate.t
+t/107multi-gzip.t
+t/107multi-rawdeflate.t
+t/107multi-zip.t
+t/108anyunc-bzip2.t
+t/108anyunc-deflate.t
+t/108anyunc-gzip.t
+t/108anyunc-rawdeflate.t
+t/108anyunc-transparent.t
+t/108anyunc-zip.t
+t/109merge-deflate.t
+t/109merge-gzip.t
+t/109merge-rawdeflate.t
+t/109merge-zip.t
+t/110encode-bzip2.t
+t/110encode-deflate.t
+t/110encode-gzip.t
+t/110encode-rawdeflate.t
+t/110encode-zip.t
+t/999pod.t
+t/99pod.t
+t/cz-01version.t
+t/cz-03zlib-v1.t*
+t/cz-05examples.t
+t/cz-06gzsetp.t
+t/cz-08encoding.t
+t/cz-14gzopen.t
+t/cz-99pod.t
+t/compress/any.pl
+t/compress/anyunc.pl
+t/compress/CompTestUtils.pm
+t/compress/destroy.pl
+t/compress/encode.pl
+t/compress/generic.pl
+t/compress/merge.pl
+t/compress/multi.pl
+t/compress/newtied.pl
+t/compress/oneshot.pl
+t/compress/prime.pl
+t/compress/tied.pl
+t/compress/truncate.pl
+t/compress/zlib-generic.pl
+t/globmapper.t
+t/Test/Builder.pm
+t/Test/More.pm
+META.yml Module meta-data (added by MakeMaker)
+t/Test/Simple.pm
use strict ;
require 5.004 ;
+$::VERSION = '2.017' ;
+
use private::MakeUtil;
use ExtUtils::MakeMaker 5.16 ;
-UpDowngrade(getPerlFiles('MANIFEST'))
+UpDowngrade(getPerlFiles('MANIFEST'))
unless $ENV{PERL_CORE};
WriteMakefile(
- NAME => 'IO::Compress::Base',
+ NAME => 'IO::Compress',
VERSION_FROM => 'lib/IO/Compress/Base.pm',
'dist' => { COMPRESS => 'gzip',
TARFLAGS => '-chvf',
(
$ENV{SKIP_FOR_CORE}
? (MAN3PODS => {})
- : (PREREQ_PM => { 'Scalar::Util' => 0,
+ : (PREREQ_PM => { 'Compress::Raw::Bzip2' => $::VERSION,
+ 'Compress::Raw::Zlib' => $::VERSION,
$] >= 5.005 && $] < 5.006
? ('File::BSDGlob' => 0)
: () }
(
$] >= 5.005
- ? (ABSTRACT_FROM => 'lib/IO/Compress/Base.pm',
- AUTHOR => 'Paul Marquess <pmqs@cpan.org>')
- : ()
- ),
-
- INSTALLDIRS => ($] >= 5.009 ? 'perl' : 'site'),
-
- (
- $] >= 5.009 && ! $ENV{PERL_CORE}
- ? (INST_LIB => 'blib/arch')
+ ? (ABSTRACT => 'IO Interface to compressed data files/buffers',
+ AUTHOR => 'Paul Marquess <pmqs@cpan.org>')
: ()
),
((ExtUtils::MakeMaker->VERSION() gt '6.30') ?
- ('LICENSE' => 'perl') : ()),
-
+ ('LICENSE' => 'perl') : ()),
+
) ;
# end of file Makefile.PL
-
- IO-Compress-Base
+ IO-Compress
- Version 2.015
+ Version 2.017
- 2nd September 2008
+ 28th February 2009
- Copyright (c) 2005-2008 Paul Marquess. All rights reserved.
+ Copyright (c) 1995-2009 Paul Marquess. All rights reserved.
This program is free software; you can redistribute it
and/or modify it under the same terms as Perl itself.
DESCRIPTION
-----------
-This module is the base class for all IO::Compress and IO::Uncompress
-modules.
+This distribution provides a Perl interface to allow reading and writing of
+compressed data created with the zlib and bziip2 libraries.
+
+The distribiution also ocontain the Compress::Zlib modeule.
PREREQUISITES
-------------
-Before you can build IO-Compress-Base you need to have the following
+Before you can build IO-Compress you need to have the following
installed on your system:
* Perl 5.004 or better.
+ * Compress::Raw::Zlib
+ * Compress::Raw::Bzip2
BUILDING THE MODULE
-------------------
INSTALLATION
------------
-To install IO-Compress-Base, run the command below:
+To install IO-Compress, run the command below:
make install
FEEDBACK
--------
-How to report a problem with IO-Compress-Base.
+How to report a problem with IO-Compress.
To help me help you, I need all of the following information:
If your perl does not understand the "-V" option it is too
old. This module needs Perl version 5.004 or better.
- b. The version of IO-Compress-Base you have.
- If you have successfully installed IO-Compress-Base, this one-liner
+ b. The version of IO-Compress you have.
+ If you have successfully installed IO-Compress, this one-liner
will tell you:
- perl -MIO::Compress::Base -e 'print qq[ver $IO::Compress::Base::VERSION\n]'
+ perl -MIO::Compress::Gzip -e 'print qq[ver $IO::Compress::Gzip::VERSION\n]'
If you are running windows use this
- perl -MIO::Compress::Base -e "print qq[ver $IO::Compress::Base::VERSION\n]"
+ perl -MIO::Compress::Gzip -e "print qq[ver $IO::Compress::Gzip::VERSION\n]"
- If you haven't installed IO-Compress-Base then search IO::Compress::Base.pm
+ If you haven't installed IO-Compress then search IO::Compress::Gzip.pm
for a line like this:
- $VERSION = "2.015" ;
+ $VERSION = "2.017" ;
- 2. If you are having problems building IO-Compress-Base, send me a
- complete log of what happened. Start by unpacking the IO-Compress-Base
+ 2. If you are having problems building IO-Compress, send me a
+ complete log of what happened. Start by unpacking the IO-Compress
module into a fresh directory and keep a log of all the steps
[edit config.in, if necessary]
--- /dev/null
+#!/usr/local/bin/perl
+
+use strict ;
+use warnings ;
+
+use IO::Uncompress::AnyInflate qw( anyinflate $AnyInflateError );
+
+@ARGV = '-' unless @ARGV ;
+
+foreach my $file (@ARGV) {
+
+ anyinflate $file => '-',
+ Transparent => 1,
+ Strict => 0,
+ or die "Cannot uncompress '$file': $AnyInflateError\n" ;
+
+}
#!/usr/local/bin/perl
-use IO::Uncompress::Gunzip qw( $GunzipError );
+use IO::Uncompress::Bunzip2 qw( $Bunzip2Error );
use strict ;
-use warnings ;
+local ($^W) = 1; #use warnings ;
#die "Usage: gzcat file...\n"
# unless @ARGV ;
foreach $file (@ARGV) {
- my $gz = new IO::Uncompress::Gunzip $file
- or die "Cannot open $file: $GunzipError\n" ;
+ my $gz = new IO::Uncompress::Bunzip2 $file
+ or die "Cannot open $file: $Bunzip2Error\n" ;
print $buffer
while ($s = $gz->read($buffer)) > 0 ;
- die "Error reading from $file: $GunzipError\n"
+ die "Error reading from $file: $Bunzip2Error\n"
if $s < 0 ;
$gz->close() ;
--- /dev/null
+#!/usr/bin/perl
+
+use strict ;
+local ($^W) = 1; #use warnings ;
+use IO::Uncompress::Bunzip2 qw($Bunzip2Error);
+
+die "Usage: gzgrep pattern [file...]\n"
+ unless @ARGV >= 1;
+
+my $pattern = shift ;
+my $file ;
+
+@ARGV = '-' unless @ARGV ;
+
+foreach $file (@ARGV) {
+ my $gz = new IO::Uncompress::Bunzip2 $file
+ or die "Cannot uncompress $file: $Bunzip2Error\n" ;
+
+ while (<$gz>) {
+ print if /$pattern/ ;
+ }
+
+ die "Error reading from $file: $Bunzip2Error\n"
+ if $Bunzip2Error ;
+}
--- /dev/null
+#!/usr/local/bin/perl
+
+use strict ;
+local ($^W) = 1; #use warnings ;
+use IO::Compress::Bzip2 qw(:all);
+
+bzip2 '-' => '-'
+ or die "bzstream: $Bzip2Error\n" ;
+
use IO::Handle ;
use Scalar::Util qw(dualvar);
-use IO::Compress::Base::Common 2.015 ;
-use Compress::Raw::Zlib 2.015 ;
-use IO::Compress::Gzip 2.015 ;
-use IO::Uncompress::Gunzip 2.015 ;
+use IO::Compress::Base::Common 2.017 ;
+use Compress::Raw::Zlib 2.017 ;
+use IO::Compress::Gzip 2.017 ;
+use IO::Uncompress::Gunzip 2.017 ;
use strict ;
use warnings ;
use bytes ;
our ($VERSION, $XS_VERSION, @ISA, @EXPORT, $AUTOLOAD);
-$VERSION = '2.015';
+$VERSION = '2.017';
$XS_VERSION = $VERSION;
$VERSION = eval $VERSION;
package Compress::Zlib ;
-use IO::Compress::Gzip::Constants 2.015 ;
+use IO::Compress::Gzip::Constants 2.017 ;
sub memGzip($)
{
$crc = adler32_combine($crc1, $crc2, $len2)l
$crc = crc32_combine($adler1, $adler2, $len2)
- ZLIB_VERSION
- ZLIB_VERNUM
+ my $version = Compress::Raw::Zlib::zlib_version();
=head1 DESCRIPTION
These functions allow checksums to be merged.
+=head1 Misc
+
+=head2 my $version = Compress::Zlib::zlib_version();
+
+Returns the version of the zlib library.
+
=head1 CONSTANTS
All the I<zlib> constants are automatically imported when you make use
=head1 COPYRIGHT AND LICENSE
-Copyright (c) 1995-2008 Paul Marquess. All rights reserved.
+Copyright (c) 1995-2009 Paul Marquess. All rights reserved.
This program is free software; you can redistribute it and/or
modify it under the same terms as Perl itself.
--- /dev/null
+package IO::Compress::Adapter::Bzip2 ;
+
+use strict;
+use warnings;
+use bytes;
+
+use IO::Compress::Base::Common 2.016 qw(:Status);
+
+#use Compress::Bzip2 ;
+use Compress::Raw::Bzip2 2.016 ;
+
+our ($VERSION);
+$VERSION = '2.016';
+
+sub mkCompObject
+{
+ my $BlockSize100K = shift ;
+ my $WorkFactor = shift ;
+ my $Verbosity = shift ;
+
+ my ($def, $status) = new Compress::Raw::Bzip2(1, $BlockSize100K,
+ $WorkFactor, $Verbosity);
+ #my ($def, $status) = bzdeflateInit();
+ #-BlockSize100K => $params->value('BlockSize100K'),
+ #-WorkFactor => $params->value('WorkFactor');
+
+ return (undef, "Could not create Deflate object: $status", $status)
+ if $status != BZ_OK ;
+
+ return bless {'Def' => $def,
+ 'Error' => '',
+ 'ErrorNo' => 0,
+ } ;
+}
+
+sub compr
+{
+ my $self = shift ;
+
+ my $def = $self->{Def};
+
+ #my ($out, $status) = $def->bzdeflate(defined ${$_[0]} ? ${$_[0]} : "") ;
+ my $status = $def->bzdeflate($_[0], $_[1]) ;
+ $self->{ErrorNo} = $status;
+
+ if ($status != BZ_RUN_OK)
+ {
+ $self->{Error} = "Deflate Error: $status";
+ return STATUS_ERROR;
+ }
+
+ #${ $_[1] } .= $out if defined $out;
+
+ return STATUS_OK;
+}
+
+sub flush
+{
+ my $self = shift ;
+
+ my $def = $self->{Def};
+
+ #my ($out, $status) = $def->bzflush($opt);
+ #my $status = $def->bzflush($_[0], $opt);
+ my $status = $def->bzflush($_[0]);
+ $self->{ErrorNo} = $status;
+
+ if ($status != BZ_RUN_OK)
+ {
+ $self->{Error} = "Deflate Error: $status";
+ return STATUS_ERROR;
+ }
+
+ #${ $_[0] } .= $out if defined $out ;
+ return STATUS_OK;
+
+}
+
+sub close
+{
+ my $self = shift ;
+
+ my $def = $self->{Def};
+
+ #my ($out, $status) = $def->bzclose();
+ my $status = $def->bzclose($_[0]);
+ $self->{ErrorNo} = $status;
+
+ if ($status != BZ_STREAM_END)
+ {
+ $self->{Error} = "Deflate Error: $status";
+ return STATUS_ERROR;
+ }
+
+ #${ $_[0] } .= $out if defined $out ;
+ return STATUS_OK;
+
+}
+
+
+sub reset
+{
+ my $self = shift ;
+
+ my $outer = $self->{Outer};
+
+ my ($def, $status) = new Compress::Raw::Bzip2();
+ $self->{ErrorNo} = ($status == BZ_OK) ? 0 : $status ;
+
+ if ($status != BZ_OK)
+ {
+ $self->{Error} = "Cannot create Deflate object: $status";
+ return STATUS_ERROR;
+ }
+
+ $self->{Def} = $def;
+
+ return STATUS_OK;
+}
+
+sub compressedBytes
+{
+ my $self = shift ;
+ $self->{Def}->compressedBytes();
+}
+
+sub uncompressedBytes
+{
+ my $self = shift ;
+ $self->{Def}->uncompressedBytes();
+}
+
+#sub total_out
+#{
+# my $self = shift ;
+# 0;
+#}
+#
+
+#sub total_in
+#{
+# my $self = shift ;
+# $self->{Def}->total_in();
+#}
+#
+#sub crc32
+#{
+# my $self = shift ;
+# $self->{Def}->crc32();
+#}
+#
+#sub adler32
+#{
+# my $self = shift ;
+# $self->{Def}->adler32();
+#}
+
+
+1;
+
+__END__
+
use warnings;
use bytes;
-use IO::Compress::Base::Common 2.015 qw(:Status);
+use IO::Compress::Base::Common 2.017 qw(:Status);
-use Compress::Raw::Zlib 2.015 qw(Z_OK Z_FINISH MAX_WBITS) ;
+use Compress::Raw::Zlib 2.017 qw(Z_OK Z_FINISH MAX_WBITS) ;
our ($VERSION);
-$VERSION = '2.015';
+$VERSION = '2.017';
sub mkCompObject
{
use warnings;
use bytes;
-use IO::Compress::Base::Common 2.015 qw(:Status);
+use IO::Compress::Base::Common 2.017 qw(:Status);
our ($VERSION);
-$VERSION = '2.015';
+$VERSION = '2.017';
sub mkCompObject
{
use strict ;
use warnings;
-use IO::Compress::Base::Common 2.015 ;
+use IO::Compress::Base::Common 2.017 ;
use IO::File ;
use Scalar::Util qw(blessed readonly);
our (@ISA, $VERSION);
@ISA = qw(Exporter IO::File);
-$VERSION = '2.015';
+$VERSION = '2.017';
#Can't locate object method "SWASHNEW" via package "utf8" (perhaps you forgot to load "utf8"?) at .../ext/Compress-Zlib/Gzip/blib/lib/Compress/Zlib/Common.pm line 16.
}
# If output is a file, check that it is writable
- if ($outType eq 'filename' && -e $outValue && ! -w _)
- { return $obj->saveErrorString(undef, "Output file '$outValue' is not writable" ) }
+ #no warnings;
+ #if ($outType eq 'filename' && -e $outValue && ! -w _)
+ # { return $obj->saveErrorString(undef, "Output file '$outValue' is not writable" ) }
}
}
elsif ($outType eq 'filename') {
+ no warnings;
my $mode = '>' ;
$mode = '>>'
if $appendOutput;
$self->croakError("$from: output parameter not a filename, filehandle or scalar ref")
if ! $outType ;
- $self->croakError("$from: output filename is undef or null string")
- if $outType eq 'filename' && (! defined $_[0] || $_[0] eq '') ;
+ #$self->croakError("$from: output filename is undef or null string")
+ #if $outType eq 'filename' && (! defined $_[0] || $_[0] eq '') ;
$self->croakError("$from: output buffer is read-only")
if $outType eq 'buffer' && readonly(${ $_[0] });
=head1 COPYRIGHT AND LICENSE
-Copyright (c) 2005-2008 Paul Marquess. All rights reserved.
+Copyright (c) 2005-2009 Paul Marquess. All rights reserved.
This program is free software; you can redistribute it and/or
modify it under the same terms as Perl itself.
require Exporter;
our ($VERSION, @ISA, @EXPORT, %EXPORT_TAGS, $HAS_ENCODE);
@ISA = qw(Exporter);
-$VERSION = '2.015';
+$VERSION = '2.017';
@EXPORT = qw( isaFilehandle isaFilename whatIsInput whatIsOutput
isaFileGlobString cleanFileGlobString oneTarget
-package IO::Compress::Deflate ;
+package IO::Compress::Bzip2 ;
use strict ;
use warnings;
use bytes;
-
require Exporter ;
-use IO::Compress::RawDeflate 2.015 ;
+use IO::Compress::Base 2.016 ;
+
+use IO::Compress::Base::Common 2.016 qw(createSelfTiedObject);
+use IO::Compress::Adapter::Bzip2 2.016 ;
-use Compress::Raw::Zlib 2.015 ;
-use IO::Compress::Zlib::Constants 2.015 ;
-use IO::Compress::Base::Common 2.015 qw(createSelfTiedObject);
-our ($VERSION, @ISA, @EXPORT_OK, %EXPORT_TAGS, $DeflateError);
+our ($VERSION, @ISA, @EXPORT_OK, %EXPORT_TAGS, $Bzip2Error);
-$VERSION = '2.015';
-$DeflateError = '';
+$VERSION = '2.016';
+$Bzip2Error = '';
-@ISA = qw(Exporter IO::Compress::RawDeflate);
-@EXPORT_OK = qw( $DeflateError deflate ) ;
-%EXPORT_TAGS = %IO::Compress::RawDeflate::DEFLATE_CONSTANTS ;
+@ISA = qw(Exporter IO::Compress::Base);
+@EXPORT_OK = qw( $Bzip2Error bzip2 ) ;
+%EXPORT_TAGS = %IO::Compress::Base::EXPORT_TAGS ;
push @{ $EXPORT_TAGS{all} }, @EXPORT_OK ;
Exporter::export_ok_tags('all');
+
sub new
{
my $class = shift ;
- my $obj = createSelfTiedObject($class, \$DeflateError);
+ my $obj = createSelfTiedObject($class, \$Bzip2Error);
return $obj->_create(undef, @_);
}
-sub deflate
+sub bzip2
{
- my $obj = createSelfTiedObject(undef, \$DeflateError);
- return $obj->_def(@_);
+ my $obj = createSelfTiedObject(undef, \$Bzip2Error);
+ $obj->_def(@_);
}
-sub bitmask($$$$)
+sub mkHeader
{
- my $into = shift ;
- my $value = shift ;
- my $offset = shift ;
- my $mask = shift ;
+ my $self = shift ;
+ return '';
- return $into | (($value & $mask) << $offset ) ;
}
-sub mkDeflateHdr($$$;$)
+sub getExtraParams
{
- my $method = shift ;
- my $cinfo = shift;
- my $level = shift;
- my $fdict_adler = shift ;
-
- my $cmf = 0;
- my $flg = 0;
- my $fdict = 0;
- $fdict = 1 if defined $fdict_adler;
-
- $cmf = bitmask($cmf, $method, ZLIB_CMF_CM_OFFSET, ZLIB_CMF_CM_BITS);
- $cmf = bitmask($cmf, $cinfo, ZLIB_CMF_CINFO_OFFSET, ZLIB_CMF_CINFO_BITS);
-
- $flg = bitmask($flg, $fdict, ZLIB_FLG_FDICT_OFFSET, ZLIB_FLG_FDICT_BITS);
- $flg = bitmask($flg, $level, ZLIB_FLG_LEVEL_OFFSET, ZLIB_FLG_LEVEL_BITS);
+ my $self = shift ;
- my $fcheck = 31 - ($cmf * 256 + $flg) % 31 ;
- $flg = bitmask($flg, $fcheck, ZLIB_FLG_FCHECK_OFFSET, ZLIB_FLG_FCHECK_BITS);
+ use IO::Compress::Base::Common 2.016 qw(:Parse);
+
+ return (
+ 'BlockSize100K' => [0, 1, Parse_unsigned, 1],
+ 'WorkFactor' => [0, 1, Parse_unsigned, 0],
+ 'Verbosity' => [0, 1, Parse_boolean, 0],
+ );
+}
- my $hdr = pack("CC", $cmf, $flg) ;
- $hdr .= pack("N", $fdict_adler) if $fdict ;
- return $hdr;
-}
-sub mkHeader
+sub ckParams
{
my $self = shift ;
- my $param = shift ;
-
- my $level = $param->value('Level');
- my $strategy = $param->value('Strategy');
-
- my $lflag ;
- $level = 6
- if $level == Z_DEFAULT_COMPRESSION ;
+ my $got = shift;
+
+ # check that BlockSize100K is a number between 1 & 9
+ if ($got->parsed('BlockSize100K')) {
+ my $value = $got->value('BlockSize100K');
+ return $self->saveErrorString(undef, "Parameter 'BlockSize100K' not between 1 and 9, got $value")
+ unless defined $value && $value >= 1 && $value <= 9;
- if (ZLIB_VERNUM >= 0x1210)
- {
- if ($strategy >= Z_HUFFMAN_ONLY || $level < 2)
- { $lflag = ZLIB_FLG_LEVEL_FASTEST }
- elsif ($level < 6)
- { $lflag = ZLIB_FLG_LEVEL_FAST }
- elsif ($level == 6)
- { $lflag = ZLIB_FLG_LEVEL_DEFAULT }
- else
- { $lflag = ZLIB_FLG_LEVEL_SLOWEST }
}
- else
- {
- $lflag = ($level - 1) >> 1 ;
- $lflag = 3 if $lflag > 3 ;
+
+ # check that WorkFactor between 0 & 250
+ if ($got->parsed('WorkFactor')) {
+ my $value = $got->value('WorkFactor');
+ return $self->saveErrorString(undef, "Parameter 'WorkFactor' not between 0 and 250, got $value")
+ unless $value >= 0 && $value <= 250;
}
- #my $wbits = (MAX_WBITS - 8) << 4 ;
- my $wbits = 7;
- mkDeflateHdr(ZLIB_CMF_CM_DEFLATED, $wbits, $lflag);
+ return 1 ;
}
-sub ckParams
+
+sub mkComp
{
my $self = shift ;
- my $got = shift;
+ my $got = shift ;
+
+ my $BlockSize100K = $got->value('BlockSize100K');
+ my $WorkFactor = $got->value('WorkFactor');
+ my $Verbosity = $got->value('Verbosity');
+
+ my ($obj, $errstr, $errno) = IO::Compress::Adapter::Bzip2::mkCompObject(
+ $BlockSize100K, $WorkFactor,
+ $Verbosity);
+
+ return $self->saveErrorString(undef, $errstr, $errno)
+ if ! defined $obj;
- $got->value('ADLER32' => 1);
- return 1 ;
+ return $obj;
}
sub mkTrailer
{
my $self = shift ;
- return pack("N", *$self->{Compress}->adler32()) ;
+ return '';
}
sub mkFinalTrailer
#sub newHeader
#{
# my $self = shift ;
-# return *$self->{Header};
+# return '';
#}
-sub getExtraParams
-{
- my $self = shift ;
- return $self->getZlibParams(),
-}
-
sub getInverseClass
{
- return ('IO::Uncompress::Inflate',
- \$IO::Uncompress::Inflate::InflateError);
+ return ('IO::Uncompress::Bunzip2');
}
sub getFileInfo
}
-
-
1;
__END__
=head1 NAME
-IO::Compress::Deflate - Write RFC 1950 files/buffers
+IO::Compress::Bzip2 - Write bzip2 files/buffers
=head1 SYNOPSIS
- use IO::Compress::Deflate qw(deflate $DeflateError) ;
+ use IO::Compress::Bzip2 qw(bzip2 $Bzip2Error) ;
- my $status = deflate $input => $output [,OPTS]
- or die "deflate failed: $DeflateError\n";
+ my $status = bzip2 $input => $output [,OPTS]
+ or die "bzip2 failed: $Bzip2Error\n";
- my $z = new IO::Compress::Deflate $output [,OPTS]
- or die "deflate failed: $DeflateError\n";
+ my $z = new IO::Compress::Bzip2 $output [,OPTS]
+ or die "bzip2 failed: $Bzip2Error\n";
$z->print($string);
$z->printf($format, $string);
$z->input_line_number();
$z->newStream( [OPTS] );
- $z->deflateParams();
-
$z->close() ;
- $DeflateError ;
+ $Bzip2Error ;
# IO::File mode
=head1 DESCRIPTION
-This module provides a Perl interface that allows writing compressed
-data to files or buffer as defined in RFC 1950.
+This module provides a Perl interface that allows writing bzip2
+compressed data to files or buffer.
-For reading RFC 1950 files/buffers, see the companion module
-L<IO::Uncompress::Inflate|IO::Uncompress::Inflate>.
+For reading bzip2 files/buffers, see the companion module
+L<IO::Uncompress::Bunzip2|IO::Uncompress::Bunzip2>.
=head1 Functional Interface
-A top-level function, C<deflate>, is provided to carry out
+A top-level function, C<bzip2>, is provided to carry out
"one-shot" compression between buffers and/or files. For finer
control over the compression process, see the L</"OO Interface">
section.
- use IO::Compress::Deflate qw(deflate $DeflateError) ;
+ use IO::Compress::Bzip2 qw(bzip2 $Bzip2Error) ;
- deflate $input => $output [,OPTS]
- or die "deflate failed: $DeflateError\n";
+ bzip2 $input => $output [,OPTS]
+ or die "bzip2 failed: $Bzip2Error\n";
The functional interface needs Perl5.005 or better.
-=head2 deflate $input => $output [, OPTS]
+=head2 bzip2 $input => $output [, OPTS]
-C<deflate> expects at least two parameters, C<$input> and C<$output>.
+C<bzip2> expects at least two parameters, C<$input> and C<$output>.
=head3 The C<$input> parameter
=item An Input FileGlob string
If C<$input> is a string that is delimited by the characters "<" and ">"
-C<deflate> will assume that it is an I<input fileglob string>. The
+C<bzip2> will assume that it is an I<input fileglob string>. The
input is the list of files that match the fileglob.
If the fileglob does not match any files ...
=item An Output FileGlob
If C<$output> is a string that is delimited by the characters "<" and ">"
-C<deflate> will assume that it is an I<output fileglob string>. The
+C<bzip2> will assume that it is an I<output fileglob string>. The
output is the list of files that match the fileglob.
When C<$output> is an fileglob string, C<$input> must also be a fileglob
=head2 Optional Parameters
-Unless specified below, the optional parameters for C<deflate>,
+Unless specified below, the optional parameters for C<bzip2>,
C<OPTS>, are the same as those used with the OO interface defined in the
L</"Constructor Options"> section below.
=item C<< AutoClose => 0|1 >>
This option applies to any input or output data streams to
-C<deflate> that are filehandles.
+C<bzip2> that are filehandles.
If C<AutoClose> is specified, and the value is true, it will result in all
-input and/or output filehandles being closed once C<deflate> has
+input and/or output filehandles being closed once C<bzip2> has
completed.
This parameter defaults to 0.
=head2 Examples
To read the contents of the file C<file1.txt> and write the compressed
-data to the file C<file1.txt.1950>.
+data to the file C<file1.txt.bz2>.
use strict ;
use warnings ;
- use IO::Compress::Deflate qw(deflate $DeflateError) ;
+ use IO::Compress::Bzip2 qw(bzip2 $Bzip2Error) ;
my $input = "file1.txt";
- deflate $input => "$input.1950"
- or die "deflate failed: $DeflateError\n";
+ bzip2 $input => "$input.bz2"
+ or die "bzip2 failed: $Bzip2Error\n";
To read from an existing Perl filehandle, C<$input>, and write the
compressed data to a buffer, C<$buffer>.
use strict ;
use warnings ;
- use IO::Compress::Deflate qw(deflate $DeflateError) ;
+ use IO::Compress::Bzip2 qw(bzip2 $Bzip2Error) ;
use IO::File ;
my $input = new IO::File "<file1.txt"
or die "Cannot open 'file1.txt': $!\n" ;
my $buffer ;
- deflate $input => \$buffer
- or die "deflate failed: $DeflateError\n";
+ bzip2 $input => \$buffer
+ or die "bzip2 failed: $Bzip2Error\n";
To compress all files in the directory "/my/home" that match "*.txt"
and store the compressed data in the same directory
use strict ;
use warnings ;
- use IO::Compress::Deflate qw(deflate $DeflateError) ;
+ use IO::Compress::Bzip2 qw(bzip2 $Bzip2Error) ;
- deflate '</my/home/*.txt>' => '<*.1950>'
- or die "deflate failed: $DeflateError\n";
+ bzip2 '</my/home/*.txt>' => '<*.bz2>'
+ or die "bzip2 failed: $Bzip2Error\n";
and if you want to compress each file one at a time, this will do the trick
use strict ;
use warnings ;
- use IO::Compress::Deflate qw(deflate $DeflateError) ;
+ use IO::Compress::Bzip2 qw(bzip2 $Bzip2Error) ;
for my $input ( glob "/my/home/*.txt" )
{
- my $output = "$input.1950" ;
- deflate $input => $output
- or die "Error compressing '$input': $DeflateError\n";
+ my $output = "$input.bz2" ;
+ bzip2 $input => $output
+ or die "Error compressing '$input': $Bzip2Error\n";
}
=head1 OO Interface
=head2 Constructor
-The format of the constructor for C<IO::Compress::Deflate> is shown below
+The format of the constructor for C<IO::Compress::Bzip2> is shown below
- my $z = new IO::Compress::Deflate $output [,OPTS]
- or die "IO::Compress::Deflate failed: $DeflateError\n";
+ my $z = new IO::Compress::Bzip2 $output [,OPTS]
+ or die "IO::Compress::Bzip2 failed: $Bzip2Error\n";
-It returns an C<IO::Compress::Deflate> object on success and undef on failure.
-The variable C<$DeflateError> will contain an error message on failure.
+It returns an C<IO::Compress::Bzip2> object on success and undef on failure.
+The variable C<$Bzip2Error> will contain an error message on failure.
If you are running Perl 5.005 or better the object, C<$z>, returned from
-IO::Compress::Deflate can be used exactly like an L<IO::File|IO::File> filehandle.
+IO::Compress::Bzip2 can be used exactly like an L<IO::File|IO::File> filehandle.
This means that all normal output file operations can be carried out
with C<$z>.
For example, to write to a compressed file/buffer you can use either of
=back
-If the C<$output> parameter is any other type, C<IO::Compress::Deflate>::new will
+If the C<$output> parameter is any other type, C<IO::Compress::Bzip2>::new will
return undef.
=head2 Constructor Options
This option is only valid when the C<$output> parameter is a filehandle. If
specified, and the value is true, it will result in the C<$output> being
-closed once either the C<close> method is called or the C<IO::Compress::Deflate>
+closed once either the C<close> method is called or the C<IO::Compress::Bzip2>
object is destroyed.
This parameter defaults to 0.
This parameter defaults to 0.
-=item C<< Merge => 0|1 >>
-
-This option is used to compress input data and append it to an existing
-compressed data stream in C<$output>. The end result is a single compressed
-data stream stored in C<$output>.
-
-It is a fatal error to attempt to use this option when C<$output> is not an
-RFC 1950 data stream.
-
-There are a number of other limitations with the C<Merge> option:
-
-=over 5
+=item C<< BlockSize100K => number >>
-=item 1
+Specify the number of 100K blocks bzip2 uses during compression.
-This module needs to have been built with zlib 1.2.1 or better to work. A
-fatal error will be thrown if C<Merge> is used with an older version of
-zlib.
+Valid values are from 1 to 9, where 9 is best compression.
-=item 2
-
-If C<$output> is a file or a filehandle, it must be seekable.
-
-=back
-
-This parameter defaults to 0.
+The default is 1.
-=item -Level
+=item C<< WorkFactor => number >>
-Defines the compression level used by zlib. The value should either be
-a number between 0 and 9 (0 means no compression and 9 is maximum
-compression), or one of the symbolic constants defined below.
+Specifies how much effort bzip2 should take before resorting to a slower
+fallback compression algorithm.
- Z_NO_COMPRESSION
- Z_BEST_SPEED
- Z_BEST_COMPRESSION
- Z_DEFAULT_COMPRESSION
+Valid values range from 0 to 250, where 0 means use the default value 30.
-The default is Z_DEFAULT_COMPRESSION.
-
-Note, these constants are not imported by C<IO::Compress::Deflate> by default.
-
- use IO::Compress::Deflate qw(:strategy);
- use IO::Compress::Deflate qw(:constants);
- use IO::Compress::Deflate qw(:all);
-
-=item -Strategy
-
-Defines the strategy used to tune the compression. Use one of the symbolic
-constants defined below.
-
- Z_FILTERED
- Z_HUFFMAN_ONLY
- Z_RLE
- Z_FIXED
- Z_DEFAULT_STRATEGY
-
-The default is Z_DEFAULT_STRATEGY.
+The default is 0.
=item C<< Strict => 0|1 >>
Usage is
$z->flush;
- $z->flush($flush_type);
Flushes any pending compressed data to the output file/buffer.
-This method takes an optional parameter, C<$flush_type>, that controls
-how the flushing will be carried out. By default the C<$flush_type>
-used is C<Z_FINISH>. Other valid values for C<$flush_type> are
-C<Z_NO_FLUSH>, C<Z_SYNC_FLUSH>, C<Z_FULL_FLUSH> and C<Z_BLOCK>. It is
-strongly recommended that you only set the C<flush_type> parameter if
-you fully understand the implications of what it does - overuse of C<flush>
-can seriously degrade the level of compression achieved. See the C<zlib>
-documentation for details.
+TODO
Returns true on success.
Flushes any pending compressed data and then closes the output file/buffer.
For most versions of Perl this method will be automatically invoked if
-the IO::Compress::Deflate object is destroyed (either explicitly or by the
+the IO::Compress::Bzip2 object is destroyed (either explicitly or by the
variable with the reference to the object going out of scope). The
exceptions are Perl versions 5.005 through 5.00504 and 5.8.0. In
these cases, the C<close> method will be called automatically, but
Returns true on success, otherwise 0.
-If the C<AutoClose> option has been enabled when the IO::Compress::Deflate
+If the C<AutoClose> option has been enabled when the IO::Compress::Bzip2
object was created, and the object is associated with a file, the
underlying file will also be closed.
See the L</"Constructor Options"> section for more details.
-=head2 deflateParams
-
-Usage is
-
- $z->deflateParams
-
-TODO
-
=head1 Importing
-A number of symbolic constants are required by some methods in
-C<IO::Compress::Deflate>. None are imported by default.
+No symbolic constants are required by this IO::Compress::Bzip2 at present.
=over 5
=item :all
-Imports C<deflate>, C<$DeflateError> and all symbolic
-constants that can be used by C<IO::Compress::Deflate>. Same as doing this
-
- use IO::Compress::Deflate qw(deflate $DeflateError :constants) ;
-
-=item :constants
-
-Import all symbolic constants. Same as doing this
-
- use IO::Compress::Deflate qw(:flush :level :strategy) ;
-
-=item :flush
-
-These symbolic constants are used by the C<flush> method.
+Imports C<bzip2> and C<$Bzip2Error>.
+Same as doing this
- Z_NO_FLUSH
- Z_PARTIAL_FLUSH
- Z_SYNC_FLUSH
- Z_FULL_FLUSH
- Z_FINISH
- Z_BLOCK
+ use IO::Compress::Bzip2 qw(bzip2 $Bzip2Error) ;
-=item :level
-
-These symbolic constants are used by the C<Level> option in the constructor.
-
- Z_NO_COMPRESSION
- Z_BEST_SPEED
- Z_BEST_COMPRESSION
- Z_DEFAULT_COMPRESSION
-
-=item :strategy
-
-These symbolic constants are used by the C<Strategy> option in the constructor.
-
- Z_FILTERED
- Z_HUFFMAN_ONLY
- Z_RLE
- Z_FIXED
- Z_DEFAULT_STRATEGY
-
-
=back
=head2 Apache::GZip Revisited
-See L<IO::Compress::Zlib::FAQ|IO::Compress::Zlib::FAQ/"Apache::GZip Revisited">
+See L<IO::Compress::Bzip2::FAQ|IO::Compress::Bzip2::FAQ/"Apache::GZip Revisited">
=head2 Working with Net::FTP
-See L<IO::Compress::Zlib::FAQ|IO::Compress::Zlib::FAQ/"Compressed files and Net::FTP">
+See L<IO::Compress::Bzip2::FAQ|IO::Compress::Bzip2::FAQ/"Compressed files and Net::FTP">
=head1 SEE ALSO
-L<Compress::Zlib>, L<IO::Compress::Gzip>, L<IO::Uncompress::Gunzip>, L<IO::Uncompress::Inflate>, L<IO::Compress::RawDeflate>, L<IO::Uncompress::RawInflate>, L<IO::Compress::Bzip2>, L<IO::Uncompress::Bunzip2>, L<IO::Compress::Lzop>, L<IO::Uncompress::UnLzop>, L<IO::Compress::Lzf>, L<IO::Uncompress::UnLzf>, L<IO::Uncompress::AnyInflate>, L<IO::Uncompress::AnyUncompress>
+L<Compress::Zlib>, L<IO::Compress::Gzip>, L<IO::Uncompress::Gunzip>, L<IO::Compress::Deflate>, L<IO::Uncompress::Inflate>, L<IO::Compress::RawDeflate>, L<IO::Uncompress::RawInflate>, L<IO::Uncompress::Bunzip2>, L<IO::Compress::Lzop>, L<IO::Uncompress::UnLzop>, L<IO::Compress::Lzf>, L<IO::Uncompress::UnLzf>, L<IO::Uncompress::AnyInflate>, L<IO::Uncompress::AnyUncompress>
L<Compress::Zlib::FAQ|Compress::Zlib::FAQ>
L<Archive::Tar|Archive::Tar>,
L<IO::Zlib|IO::Zlib>
-For RFC 1950, 1951 and 1952 see
-F<http://www.faqs.org/rfcs/rfc1950.html>,
-F<http://www.faqs.org/rfcs/rfc1951.html> and
-F<http://www.faqs.org/rfcs/rfc1952.html>
-
-The I<zlib> compression library was written by Jean-loup Gailly
-F<gzip@prep.ai.mit.edu> and Mark Adler F<madler@alumni.caltech.edu>.
-
-The primary site for the I<zlib> compression library is
-F<http://www.zlib.org>.
+The primary site for the bzip2 program is F<http://www.bzip.org>.
-The primary site for gzip is F<http://www.gzip.org>.
+See the module L<Compress::Bzip2|Compress::Bzip2>
=head1 AUTHOR
require Exporter ;
-use IO::Compress::RawDeflate 2.015 ;
+use IO::Compress::RawDeflate 2.017 ;
-use Compress::Raw::Zlib 2.015 ;
-use IO::Compress::Zlib::Constants 2.015 ;
-use IO::Compress::Base::Common 2.015 qw(createSelfTiedObject);
+use Compress::Raw::Zlib 2.017 ;
+use IO::Compress::Zlib::Constants 2.017 ;
+use IO::Compress::Base::Common 2.017 qw(createSelfTiedObject);
our ($VERSION, @ISA, @EXPORT_OK, %EXPORT_TAGS, $DeflateError);
-$VERSION = '2.015';
+$VERSION = '2.017';
$DeflateError = '';
@ISA = qw(Exporter IO::Compress::RawDeflate);
=head2 Apache::GZip Revisited
-See L<IO::Compress::Zlib::FAQ|IO::Compress::Zlib::FAQ/"Apache::GZip Revisited">
+See L<IO::Compress::FAQ|IO::Compress::FAQ/"Apache::GZip Revisited">
=head2 Working with Net::FTP
-See L<IO::Compress::Zlib::FAQ|IO::Compress::Zlib::FAQ/"Compressed files and Net::FTP">
+See L<IO::Compress::FAQ|IO::Compress::FAQ/"Compressed files and Net::FTP">
=head1 SEE ALSO
=head1 COPYRIGHT AND LICENSE
-Copyright (c) 2005-2008 Paul Marquess. All rights reserved.
+Copyright (c) 2005-2009 Paul Marquess. All rights reserved.
This program is free software; you can redistribute it and/or
modify it under the same terms as Perl itself.
use bytes;
-use IO::Compress::RawDeflate 2.015 ;
+use IO::Compress::RawDeflate 2.017 ;
-use Compress::Raw::Zlib 2.015 ;
-use IO::Compress::Base::Common 2.015 qw(:Status :Parse createSelfTiedObject);
-use IO::Compress::Gzip::Constants 2.015 ;
-use IO::Compress::Zlib::Extra 2.015 ;
+use Compress::Raw::Zlib 2.017 ;
+use IO::Compress::Base::Common 2.017 qw(:Status :Parse createSelfTiedObject);
+use IO::Compress::Gzip::Constants 2.017 ;
+use IO::Compress::Zlib::Extra 2.017 ;
BEGIN
{
our ($VERSION, @ISA, @EXPORT_OK, %EXPORT_TAGS, $GzipError);
-$VERSION = '2.015';
+$VERSION = '2.017';
$GzipError = '' ;
@ISA = qw(Exporter IO::Compress::RawDeflate);
=head2 Apache::GZip Revisited
-See L<IO::Compress::Zlib::FAQ|IO::Compress::Zlib::FAQ/"Apache::GZip Revisited">
+See L<IO::Compress::FAQ|IO::Compress::FAQ/"Apache::GZip Revisited">
=head2 Working with Net::FTP
-See L<IO::Compress::Zlib::FAQ|IO::Compress::Zlib::FAQ/"Compressed files and Net::FTP">
+See L<IO::Compress::FAQ|IO::Compress::FAQ/"Compressed files and Net::FTP">
=head1 SEE ALSO
=head1 COPYRIGHT AND LICENSE
-Copyright (c) 2005-2008 Paul Marquess. All rights reserved.
+Copyright (c) 2005-2009 Paul Marquess. All rights reserved.
This program is free software; you can redistribute it and/or
modify it under the same terms as Perl itself.
our ($VERSION, @ISA, @EXPORT, %GZIP_OS_Names);
our ($GZIP_FNAME_INVALID_CHAR_RE, $GZIP_FCOMMENT_INVALID_CHAR_RE);
-$VERSION = '2.015';
+$VERSION = '2.017';
@ISA = qw(Exporter);
use bytes;
-use IO::Compress::Base 2.015 ;
-use IO::Compress::Base::Common 2.015 qw(:Status createSelfTiedObject);
-use IO::Compress::Adapter::Deflate 2.015 ;
+use IO::Compress::Base 2.017 ;
+use IO::Compress::Base::Common 2.017 qw(:Status createSelfTiedObject);
+use IO::Compress::Adapter::Deflate 2.017 ;
require Exporter ;
our ($VERSION, @ISA, @EXPORT_OK, %DEFLATE_CONSTANTS, %EXPORT_TAGS, $RawDeflateError);
-$VERSION = '2.015';
+$VERSION = '2.017';
$RawDeflateError = '';
@ISA = qw(Exporter IO::Compress::Base);
{
my $self = shift ;
- use IO::Compress::Base::Common 2.015 qw(:Parse);
- use Compress::Raw::Zlib 2.015 qw(Z_DEFLATED Z_DEFAULT_COMPRESSION Z_DEFAULT_STRATEGY);
+ use IO::Compress::Base::Common 2.017 qw(:Parse);
+ use Compress::Raw::Zlib 2.017 qw(Z_DEFLATED Z_DEFAULT_COMPRESSION Z_DEFAULT_STRATEGY);
return (
=head2 Apache::GZip Revisited
-See L<IO::Compress::Zlib::FAQ|IO::Compress::Zlib::FAQ/"Apache::GZip Revisited">
+See L<IO::Compress::FAQ|IO::Compress::FAQ/"Apache::GZip Revisited">
=head2 Working with Net::FTP
-See L<IO::Compress::Zlib::FAQ|IO::Compress::Zlib::FAQ/"Compressed files and Net::FTP">
+See L<IO::Compress::FAQ|IO::Compress::FAQ/"Compressed files and Net::FTP">
=head1 SEE ALSO
=head1 COPYRIGHT AND LICENSE
-Copyright (c) 2005-2008 Paul Marquess. All rights reserved.
+Copyright (c) 2005-2009 Paul Marquess. All rights reserved.
This program is free software; you can redistribute it and/or
modify it under the same terms as Perl itself.
use warnings;
use bytes;
-use IO::Compress::Base::Common 2.015 qw(:Status createSelfTiedObject);
-use IO::Compress::RawDeflate 2.015 ;
-use IO::Compress::Adapter::Deflate 2.015 ;
-use IO::Compress::Adapter::Identity 2.015 ;
-use IO::Compress::Zlib::Extra 2.015 ;
-use IO::Compress::Zip::Constants 2.015 ;
+use IO::Compress::Base::Common 2.017 qw(:Status createSelfTiedObject);
+use IO::Compress::RawDeflate 2.017 ;
+use IO::Compress::Adapter::Deflate 2.017 ;
+use IO::Compress::Adapter::Identity 2.017 ;
+use IO::Compress::Zlib::Extra 2.017 ;
+use IO::Compress::Zip::Constants 2.017 ;
-use Compress::Raw::Zlib 2.015 qw(crc32) ;
+use Compress::Raw::Zlib 2.017 qw(crc32) ;
BEGIN
{
eval { require IO::Compress::Adapter::Bzip2 ;
- import IO::Compress::Adapter::Bzip2 2.015 ;
+ import IO::Compress::Adapter::Bzip2 2.017 ;
require IO::Compress::Bzip2 ;
- import IO::Compress::Bzip2 2.015 ;
+ import IO::Compress::Bzip2 2.017 ;
} ;
+# eval { require IO::Compress::Adapter::Lzma ;
+# import IO::Compress::Adapter::Lzma 2.016 ;
+# require IO::Compress::Lzma ;
+# import IO::Compress::Lzma 2.016 ;
+# } ;
}
our ($VERSION, @ISA, @EXPORT_OK, %EXPORT_TAGS, $ZipError);
-$VERSION = '2.015';
+$VERSION = '2.017';
$ZipError = '';
@ISA = qw(Exporter IO::Compress::RawDeflate);
);
*$self->{ZipData}{CRC32} = crc32(undef);
}
+# elsif (*$self->{ZipData}{Method} == ZIP_CM_LZMA) {
+# ($obj, $errstr, $errno) = IO::Compress::Adapter::Lzma::mkCompObject(
+# );
+# *$self->{ZipData}{CRC32} = crc32(undef);
+# }
return $self->saveErrorString(undef, $errstr, $errno)
if ! defined $obj;
if $osCode == ZIP_OS_CODE_UNIX ;
if (*$self->{ZipData}{Zip64}) {
- $empty = 0xFFFF;
+ $empty = 0xFFFFFFFF;
my $x = '';
$x .= pack "V V", 0, 0 ; # uncompressedLength
$x .= pack "V V", 0, 0 ; # compressedLength
$x .= *$self->{ZipData}{Offset}->getPacked_V64() ; # offset to local hdr
- #$x .= pack "V ", 0 ; # disk no
+ $x .= pack "V", 0 ; # disk no
$x = IO::Compress::Zlib::Extra::mkSubField(ZIP_EXTRA_ID_ZIP64, $x);
$extra .= $x;
if $method == ZIP_CM_BZIP2 and
! defined $IO::Compress::Adapter::Bzip2::VERSION;
+# return $self->saveErrorString(undef, "Lzma not available")
+# if $method == ZIP_CM_LZMA and
+# ! defined $IO::Compress::Adapter::Lzma::VERSION;
+
*$self->{ZipData}{Method} = $method;
*$self->{ZipData}{ZipComment} = $got->value('ZipComment') ;
{
my $self = shift ;
- use IO::Compress::Base::Common 2.015 qw(:Parse);
- use Compress::Raw::Zlib 2.015 qw(Z_DEFLATED Z_DEFAULT_COMPRESSION Z_DEFAULT_STRATEGY);
+ use IO::Compress::Base::Common 2.017 qw(:Parse);
+ use Compress::Raw::Zlib 2.017 qw(Z_DEFLATED Z_DEFAULT_COMPRESSION Z_DEFAULT_STRATEGY);
my @Bzip2 = ();
=head2 Apache::GZip Revisited
-See L<IO::Compress::Zlib::FAQ|IO::Compress::Zlib::FAQ/"Apache::GZip Revisited">
+See L<IO::Compress::FAQ|IO::Compress::FAQ/"Apache::GZip Revisited">
=head2 Working with Net::FTP
-See L<IO::Compress::Zlib::FAQ|IO::Compress::Zlib::FAQ/"Compressed files and Net::FTP">
+See L<IO::Compress::FAQ|IO::Compress::FAQ/"Compressed files and Net::FTP">
=head1 SEE ALSO
=head1 COPYRIGHT AND LICENSE
-Copyright (c) 2005-2008 Paul Marquess. All rights reserved.
+Copyright (c) 2005-2009 Paul Marquess. All rights reserved.
This program is free software; you can redistribute it and/or
modify it under the same terms as Perl itself.
our ($VERSION, @ISA, @EXPORT, %ZIP_CM_MIN_VERSIONS);
-$VERSION = '2.015';
+$VERSION = '2.017';
@ISA = qw(Exporter);
our ($VERSION, @ISA, @EXPORT);
-$VERSION = '2.015';
+$VERSION = '2.017';
@ISA = qw(Exporter);
our ($VERSION, @ISA, @EXPORT_OK, %EXPORT_TAGS);
-$VERSION = '2.015';
+$VERSION = '2.017';
-use IO::Compress::Gzip::Constants 2.015 ;
+use IO::Compress::Gzip::Constants 2.017 ;
sub ExtraFieldError
{
--- /dev/null
+package IO::Uncompress::Adapter::Bunzip2;
+
+use strict;
+use warnings;
+use bytes;
+
+use IO::Compress::Base::Common 2.016 qw(:Status);
+
+#use Compress::Bzip2 ;
+use Compress::Raw::Bzip2 2.016 ;
+
+our ($VERSION, @ISA);
+$VERSION = '2.016';
+
+#@ISA = qw( Compress::Raw::Bunzip2 );
+
+
+sub mkUncompObject
+{
+ my $small = shift || 0;
+ my $verbosity = shift || 0;
+
+ #my ($inflate, $status) = bzinflateInit;
+ #Small => $params->value('Small');
+ my ($inflate, $status) = new Compress::Raw::Bunzip2(1, 1, $small, $verbosity);
+
+ return (undef, "Could not create Inflation object: $status", $status)
+ if $status != BZ_OK ;
+
+ return bless {'Inf' => $inflate,
+ 'CompSize' => 0,
+ 'UnCompSize' => 0,
+ 'Error' => '',
+ } ;
+
+}
+
+sub uncompr
+{
+ my $self = shift ;
+ my $from = shift ;
+ my $to = shift ;
+ my $eof = shift ;
+
+ my $inf = $self->{Inf};
+
+ my $status = $inf->bzinflate($from, $to);
+ $self->{ErrorNo} = $status;
+
+ if ($status != BZ_STREAM_END && $eof)
+ {
+ $self->{Error} = "unexpected end of file";
+ return STATUS_ERROR;
+ }
+
+ if ($status != BZ_OK && $status != BZ_STREAM_END )
+ {
+ $self->{Error} = "Inflation Error: $status";
+ return STATUS_ERROR;
+ }
+
+
+ return STATUS_OK if $status == BZ_OK ;
+ return STATUS_ENDSTREAM if $status == BZ_STREAM_END ;
+ return STATUS_ERROR ;
+}
+
+
+#sub uncompr
+#{
+# my $self = shift ;
+#
+# my $inf = $self->{Inf};
+# my $eof = $_[2];
+#
+# #my ($out, $status) = $inf->bzinflate(${ $_[0] });
+# my $status = $inf->bzinflate($_[0], $_[1]);
+# $self->{ErrorNo} = $status;
+#
+# if (! defined $out)
+# {
+# my $err = $inf->error();
+# $self->{Error} = "Inflation Error: $err";
+# return STATUS_ERROR;
+# }
+#
+# #${ $_[1] } .= $out if defined $out;
+#
+# if ($eof)
+# {
+# #my ($out, $status) = $inf->bzclose();
+# $status = $inf->bzclose($_[1]);
+# $self->{ErrorNo} = $status;
+#
+# if (! defined $out)
+# {
+# my $err = $inf->error();
+# $self->{Error} = "Inflation Error: $err";
+# return STATUS_ERROR;
+# }
+#
+# #${ $_[1] } .= $out if defined $out;
+# return STATUS_ENDSTREAM ;
+# }
+#
+# return STATUS_OK ;
+#}
+
+#sub uncompr
+#{
+# my $self = shift ;
+#
+# my $inf = $self->{Inf};
+# my $eof = $_[2];
+#
+# my ($out, $status) = $inf->bzinflate(${ $_[0] });
+# $self->{ErrorNo} = $status;
+#
+# if ($status != BZ_STREAM_END && $eof)
+# {
+# $self->{Error} = "unexpected end of file";
+# return STATUS_ERROR;
+# }
+#
+# if ($status != BZ_OK && $status != BZ_STREAM_END )
+# {
+# my $err = $inf->error();
+# $self->{Error} = "Inflation Error: $err";
+# return STATUS_ERROR;
+# }
+#
+# ${ $_[1] } .= $out ;
+#
+# return STATUS_OK if $status == BZ_OK ;
+# return STATUS_ENDSTREAM if $status == BZ_STREAM_END ;
+# return STATUS_ERROR ;
+#}
+
+sub reset
+{
+ my $self = shift ;
+
+ my ($inf, $status) = new Compress::Raw::Bunzip2();
+ $self->{ErrorNo} = ($status == BZ_OK) ? 0 : $status ;
+
+ if ($status != BZ_OK)
+ {
+ $self->{Error} = "Cannot create Inflate object: $status";
+ return STATUS_ERROR;
+ }
+
+ $self->{Inf} = $inf;
+
+ return STATUS_OK ;
+}
+
+#sub count
+#{
+# my $self = shift ;
+# $self->{Inf}->inflateCount();
+#}
+
+sub compressedBytes
+{
+ my $self = shift ;
+ $self->{Inf}->compressedBytes();
+}
+
+sub uncompressedBytes
+{
+ my $self = shift ;
+ $self->{Inf}->uncompressedBytes();
+}
+
+sub crc32
+{
+ my $self = shift ;
+ #$self->{Inf}->crc32();
+}
+
+sub adler32
+{
+ my $self = shift ;
+ #$self->{Inf}->adler32();
+}
+
+sub sync
+{
+ my $self = shift ;
+ #( $self->{Inf}->inflateSync(@_) == BZ_OK)
+ # ? STATUS_OK
+ # : STATUS_ERROR ;
+}
+
+
+1;
+
+__END__
+
use strict;
use bytes;
-use IO::Compress::Base::Common 2.015 qw(:Status);
+use IO::Compress::Base::Common 2.017 qw(:Status);
our ($VERSION);
-$VERSION = '2.015';
+$VERSION = '2.017';
-use Compress::Raw::Zlib 2.015 ();
+use Compress::Raw::Zlib 2.017 ();
sub mkUncompObject
{
use warnings;
use bytes;
-use IO::Compress::Base::Common 2.015 qw(:Status);
-use Compress::Raw::Zlib 2.015 qw(Z_OK Z_DATA_ERROR Z_STREAM_END Z_FINISH MAX_WBITS);
+use IO::Compress::Base::Common 2.017 qw(:Status);
+use Compress::Raw::Zlib 2.017 qw(Z_OK Z_BUF_ERROR Z_STREAM_END Z_FINISH MAX_WBITS);
our ($VERSION);
-$VERSION = '2.015';
+$VERSION = '2.017';
if ($scan)
{
($inflate, $status) = new Compress::Raw::Zlib::InflateScan
+ #LimitOutput => 1,
CRC32 => $crc32,
ADLER32 => $adler32,
WindowBits => - MAX_WBITS ;
{
($inflate, $status) = new Compress::Raw::Zlib::Inflate
AppendOutput => 1,
+ LimitOutput => 1,
CRC32 => $crc32,
ADLER32 => $adler32,
WindowBits => - MAX_WBITS ;
my $status = $inf->inflate($from, $to, $eof);
$self->{ErrorNo} = $status;
- if ($status != Z_STREAM_END && $eof)
- {
- $self->{Error} = "unexpected end of file";
- return STATUS_ERROR;
- }
-
- if ($status != Z_OK && $status != Z_STREAM_END )
+ if ($status != Z_OK && $status != Z_STREAM_END && $status != Z_BUF_ERROR)
{
$self->{Error} = "Inflation Error: $status";
return STATUS_ERROR;
}
-
-
+
+ return STATUS_OK if $status == Z_BUF_ERROR ; # ???
return STATUS_OK if $status == Z_OK ;
return STATUS_ENDSTREAM if $status == Z_STREAM_END ;
return STATUS_ERROR ;
use warnings;
use bytes;
-use IO::Compress::Base::Common 2.015 qw(createSelfTiedObject);
+use IO::Compress::Base::Common 2.017 qw(createSelfTiedObject);
-use IO::Uncompress::Adapter::Inflate 2.015 ();
+use IO::Uncompress::Adapter::Inflate 2.017 ();
-use IO::Uncompress::Base 2.015 ;
-use IO::Uncompress::Gunzip 2.015 ;
-use IO::Uncompress::Inflate 2.015 ;
-use IO::Uncompress::RawInflate 2.015 ;
-use IO::Uncompress::Unzip 2.015 ;
+use IO::Uncompress::Base 2.017 ;
+use IO::Uncompress::Gunzip 2.017 ;
+use IO::Uncompress::Inflate 2.017 ;
+use IO::Uncompress::RawInflate 2.017 ;
+use IO::Uncompress::Unzip 2.017 ;
require Exporter ;
our ($VERSION, @ISA, @EXPORT_OK, %EXPORT_TAGS, $AnyInflateError);
-$VERSION = '2.015';
+$VERSION = '2.017';
$AnyInflateError = '';
@ISA = qw( Exporter IO::Uncompress::Base );
sub getExtraParams
{
- use IO::Compress::Base::Common 2.015 qw(:Parse);
+ use IO::Compress::Base::Common 2.017 qw(:Parse);
return ( 'RawInflate' => [1, 1, Parse_boolean, 0] ) ;
}
=head1 COPYRIGHT AND LICENSE
-Copyright (c) 2005-2008 Paul Marquess. All rights reserved.
+Copyright (c) 2005-2009 Paul Marquess. All rights reserved.
This program is free software; you can redistribute it and/or
modify it under the same terms as Perl itself.
use warnings;
use bytes;
-use IO::Compress::Base::Common 2.015 qw(createSelfTiedObject);
+use IO::Compress::Base::Common 2.017 qw(createSelfTiedObject);
-use IO::Uncompress::Base 2.015 ;
+use IO::Uncompress::Base 2.017 ;
require Exporter ;
our ($VERSION, @ISA, @EXPORT_OK, %EXPORT_TAGS, $AnyUncompressError);
-$VERSION = '2.015';
+$VERSION = '2.017';
$AnyUncompressError = '';
@ISA = qw( Exporter IO::Uncompress::Base );
BEGIN
{
- eval ' use IO::Uncompress::Adapter::Inflate 2.015 ;';
- eval ' use IO::Uncompress::Adapter::Bunzip2 2.015 ;';
- eval ' use IO::Uncompress::Adapter::LZO 2.015 ;';
- eval ' use IO::Uncompress::Adapter::Lzf 2.015 ;';
-
- eval ' use IO::Uncompress::Bunzip2 2.015 ;';
- eval ' use IO::Uncompress::UnLzop 2.015 ;';
- eval ' use IO::Uncompress::Gunzip 2.015 ;';
- eval ' use IO::Uncompress::Inflate 2.015 ;';
- eval ' use IO::Uncompress::RawInflate 2.015 ;';
- eval ' use IO::Uncompress::Unzip 2.015 ;';
- eval ' use IO::Uncompress::UnLzf 2.015 ;';
+ eval ' use IO::Uncompress::Adapter::Inflate 2.017 ;';
+ eval ' use IO::Uncompress::Adapter::Bunzip2 2.017 ;';
+ eval ' use IO::Uncompress::Adapter::LZO 2.017 ;';
+ eval ' use IO::Uncompress::Adapter::Lzf 2.017 ;';
+ #eval ' use IO::Uncompress::Adapter::UnLzma 2.016 ;';
+
+ eval ' use IO::Uncompress::Bunzip2 2.017 ;';
+ eval ' use IO::Uncompress::UnLzop 2.017 ;';
+ eval ' use IO::Uncompress::Gunzip 2.017 ;';
+ eval ' use IO::Uncompress::Inflate 2.017 ;';
+ eval ' use IO::Uncompress::RawInflate 2.017 ;';
+ eval ' use IO::Uncompress::Unzip 2.017 ;';
+ eval ' use IO::Uncompress::UnLzf 2.017 ;';
+ #eval ' use IO::Uncompress::UnLzma 2.016 ;';
}
sub new
sub getExtraParams
{
- use IO::Compress::Base::Common 2.015 qw(:Parse);
+ use IO::Compress::Base::Common 2.017 qw(:Parse);
return ( 'RawInflate' => [1, 1, Parse_boolean, 0] ) ;
}
}
}
+# if (defined $IO::Uncompress::UnLzma::VERSION )
+# {
+# my ($obj, $errstr, $errno) = IO::Uncompress::Adapter::UnLzma::mkUncompObject();
+#
+# return $self->saveErrorString(undef, $errstr, $errno)
+# if ! defined $obj;
+#
+# *$self->{Uncomp} = $obj;
+#
+# my @possible = qw( UnLzma );
+# #unshift @possible, 'RawInflate'
+# # if $got->value('RawInflate');
+#
+# if ( *$self->{Info} = $self->ckMagic( @possible ))
+# {
+# return 1;
+# }
+# }
+
if (defined $IO::Uncompress::Bunzip2::VERSION and
$magic = $self->ckMagic('Bunzip2')) {
*$self->{Info} = $self->readHeader($magic)
=head1 COPYRIGHT AND LICENSE
-Copyright (c) 2005-2008 Paul Marquess. All rights reserved.
+Copyright (c) 2005-2009 Paul Marquess. All rights reserved.
This program is free software; you can redistribute it and/or
modify it under the same terms as Perl itself.
@ISA = qw(Exporter IO::File);
-$VERSION = '2.015';
+$VERSION = '2.017';
use constant G_EOF => 0 ;
use constant G_ERR => -1 ;
-use IO::Compress::Base::Common 2.015 ;
+use IO::Compress::Base::Common 2.017 ;
#use Parse::Parameters ;
use IO::File ;
if $got->value('Scan');
}
else {
+ no warnings ;
my $mode = '<';
$mode = '+<' if $got->value('Scan');
*$obj->{StdIO} = ($inValue eq '-');
$self->croakError("$from: input parameter not a filename, filehandle, array ref or scalar ref")
if ! $inType ;
- if ($inType eq 'filename' )
- {
- $self->croakError("$from: input filename is undef or null string")
- if ! defined $_[0] || $_[0] eq '' ;
-
- if ($_[0] ne '-' && ! -e $_[0] )
- {
- return $self->saveErrorString(undef,
- "input file '$_[0]' does not exist", STATUS_ERROR);
- }
- }
+# if ($inType eq 'filename' )
+# {
+# return $self->saveErrorString(1, "$from: input filename is undef or null string", STATUS_ERROR)
+# if ! defined $_[0] || $_[0] eq '' ;
+#
+# if ($_[0] ne '-' && ! -e $_[0] )
+# {
+# return $self->saveErrorString(1,
+# "input file '$_[0]' does not exist", STATUS_ERROR);
+# }
+# }
return 1;
}
$x->{buff} = \$buff;
}
+ last if $status < 0 || $z->smartEof();
+ #last if $status < 0 ;
+
last
unless *$self->{MultiStream};
$status = *$self->{Uncomp}->uncompr(\$temp_buf, $buffer,
defined *$self->{CompressedInputLengthDone} ||
$self->smartEof(), $outSize);
+
+ $self->pushBack($temp_buf) if $beforeC_len != length $temp_buf;
+#return $self->saveErrorString(G_ERR, "unexpected end of file", STATUS_ERROR)
+# if $self->smartEof() && $status != STATUS_ENDSTREAM;
+
return $self->saveErrorString(G_ERR, *$self->{Uncomp}{Error}, *$self->{Uncomp}{ErrorNo})
- if $self->saveStatus($status) == STATUS_ERROR;
+ if $self->saveStatus($status) == STATUS_ERROR;
$self->postBlockChk($buffer, $before_len) == STATUS_OK
or return G_ERR;
if ($status == STATUS_ENDSTREAM) {
*$self->{EndStream} = 1 ;
- $self->pushBack($temp_buf) ;
- $temp_buf = '';
+#$self->pushBack($temp_buf) ;
+#$temp_buf = '';
my $trailer;
my $trailer_size = *$self->{Info}{TrailerLength} ;
# Need to jump through more hoops - either length or offset
# or both are specified.
my $out_buffer = *$self->{Pending} ;
+ *$self->{Pending} = '';
while (! *$self->{EndStream} && length($out_buffer) < $length)
last if $offset == 0 ;
}
+ $here = $self->tell() ;
return $offset == 0 ? 1 : 0 ;
}
=head1 COPYRIGHT AND LICENSE
-Copyright (c) 2005-2008 Paul Marquess. All rights reserved.
+Copyright (c) 2005-2009 Paul Marquess. All rights reserved.
This program is free software; you can redistribute it and/or
modify it under the same terms as Perl itself.
-
-package IO::Uncompress::Inflate ;
-# for RFC1950
+package IO::Uncompress::Bunzip2 ;
use strict ;
use warnings;
use bytes;
-use IO::Compress::Base::Common 2.015 qw(:Status createSelfTiedObject);
-use IO::Compress::Zlib::Constants 2.015 ;
+use IO::Compress::Base::Common 2.016 qw(:Status createSelfTiedObject);
-use IO::Uncompress::RawInflate 2.015 ;
+use IO::Uncompress::Base 2.016 ;
+use IO::Uncompress::Adapter::Bunzip2 2.016 ;
require Exporter ;
-our ($VERSION, @ISA, @EXPORT_OK, %EXPORT_TAGS, $InflateError);
+our ($VERSION, @ISA, @EXPORT_OK, %EXPORT_TAGS, $Bunzip2Error);
-$VERSION = '2.015';
-$InflateError = '';
+$VERSION = '2.016';
+$Bunzip2Error = '';
-@ISA = qw( Exporter IO::Uncompress::RawInflate );
-@EXPORT_OK = qw( $InflateError inflate ) ;
-%EXPORT_TAGS = %IO::Uncompress::RawInflate::DEFLATE_CONSTANTS ;
+@ISA = qw( Exporter IO::Uncompress::Base );
+@EXPORT_OK = qw( $Bunzip2Error bunzip2 ) ;
+#%EXPORT_TAGS = %IO::Uncompress::Base::EXPORT_TAGS ;
push @{ $EXPORT_TAGS{all} }, @EXPORT_OK ;
-Exporter::export_ok_tags('all');
+#Exporter::export_ok_tags('all');
sub new
{
my $class = shift ;
- my $obj = createSelfTiedObject($class, \$InflateError);
+ my $obj = createSelfTiedObject($class, \$Bunzip2Error);
$obj->_create(undef, 0, @_);
}
-sub inflate
+sub bunzip2
{
- my $obj = createSelfTiedObject(undef, \$InflateError);
+ my $obj = createSelfTiedObject(undef, \$Bunzip2Error);
return $obj->_inf(@_);
}
sub getExtraParams
{
- return ();
+ my $self = shift ;
+
+ use IO::Compress::Base::Common 2.016 qw(:Parse);
+
+ return (
+ 'Verbosity' => [1, 1, Parse_boolean, 0],
+ 'Small' => [1, 1, Parse_boolean, 0],
+ );
}
+
sub ckParams
{
my $self = shift ;
my $got = shift ;
- # gunzip always needs adler32
- $got->value('ADLER32' => 1);
+ return 1;
+}
+
+sub mkUncomp
+{
+ my $self = shift ;
+ my $got = shift ;
+
+ my $magic = $self->ckMagic()
+ or return 0;
+
+ *$self->{Info} = $self->readHeader($magic)
+ or return undef ;
+
+ my $Small = $got->value('Small');
+ my $Verbosity = $got->value('Verbosity');
+
+ my ($obj, $errstr, $errno) = IO::Uncompress::Adapter::Bunzip2::mkUncompObject(
+ $Small, $Verbosity);
+
+ return $self->saveErrorString(undef, $errstr, $errno)
+ if ! defined $obj;
+
+ *$self->{Uncomp} = $obj;
return 1;
+
}
+
sub ckMagic
{
my $self = shift;
my $magic ;
- $self->smartReadExact(\$magic, ZLIB_HEADER_SIZE);
+ $self->smartReadExact(\$magic, 4);
*$self->{HeaderPending} = $magic ;
-
+
return $self->HeaderError("Header size is " .
- ZLIB_HEADER_SIZE . " bytes")
- if length $magic != ZLIB_HEADER_SIZE;
+ 4 . " bytes")
+ if length $magic != 4;
- #return $self->HeaderError("CRC mismatch.")
- return undef
- if ! $self->isZlibMagic($magic) ;
+ return $self->HeaderError("Bad Magic.")
+ if ! isBzip2Magic($magic) ;
- *$self->{Type} = 'rfc1950';
+
+ *$self->{Type} = 'bzip2';
return $magic;
}
my $self = shift;
my $magic = shift ;
- return $self->_readDeflateHeader($magic) ;
+ $self->pushBack($magic);
+ *$self->{HeaderPending} = '';
+
+
+ return {
+ 'Type' => 'bzip2',
+ 'FingerprintLength' => 4,
+ 'HeaderLength' => 4,
+ 'TrailerLength' => 0,
+ 'Header' => '$magic'
+ };
+
}
sub chkTrailer
{
- my $self = shift;
- my $trailer = shift;
-
- my $ADLER32 = unpack("N", $trailer) ;
- *$self->{Info}{ADLER32} = $ADLER32;
- return $self->TrailerError("CRC mismatch")
- if *$self->{Strict} && $ADLER32 != *$self->{Uncomp}->adler32() ;
-
return STATUS_OK;
}
-sub isZlibMagic
+sub isBzip2Magic
{
- my $self = shift;
my $buffer = shift ;
-
- return 0
- if length $buffer < ZLIB_HEADER_SIZE ;
-
- my $hdr = unpack("n", $buffer) ;
- #return 0 if $hdr % 31 != 0 ;
- return $self->HeaderError("CRC mismatch.")
- if $hdr % 31 != 0 ;
-
- my ($CMF, $FLG) = unpack "C C", $buffer;
- my $cm = bits($CMF, ZLIB_CMF_CM_OFFSET, ZLIB_CMF_CM_BITS) ;
-
- # Only Deflate supported
- return $self->HeaderError("Not Deflate (CM is $cm)")
- if $cm != ZLIB_CMF_CM_DEFLATED ;
-
- # Max window value is 7 for Deflate.
- my $cinfo = bits($CMF, ZLIB_CMF_CINFO_OFFSET, ZLIB_CMF_CINFO_BITS) ;
- return $self->HeaderError("CINFO > " . ZLIB_CMF_CINFO_MAX .
- " (CINFO is $cinfo)")
- if $cinfo > ZLIB_CMF_CINFO_MAX ;
-
- return 1;
+ return $buffer =~ /^BZh\d$/;
}
-sub bits
-{
- my $data = shift ;
- my $offset = shift ;
- my $mask = shift ;
-
- ($data >> $offset ) & $mask & 0xFF ;
-}
-
-
-sub _readDeflateHeader
-{
- my ($self, $buffer) = @_ ;
-
-# if (! $buffer) {
-# $self->smartReadExact(\$buffer, ZLIB_HEADER_SIZE);
-#
-# *$self->{HeaderPending} = $buffer ;
-#
-# return $self->HeaderError("Header size is " .
-# ZLIB_HEADER_SIZE . " bytes")
-# if length $buffer != ZLIB_HEADER_SIZE;
-#
-# return $self->HeaderError("CRC mismatch.")
-# if ! isZlibMagic($buffer) ;
-# }
-
- my ($CMF, $FLG) = unpack "C C", $buffer;
- my $FDICT = bits($FLG, ZLIB_FLG_FDICT_OFFSET, ZLIB_FLG_FDICT_BITS ),
-
- my $cm = bits($CMF, ZLIB_CMF_CM_OFFSET, ZLIB_CMF_CM_BITS) ;
- $cm == ZLIB_CMF_CM_DEFLATED
- or return $self->HeaderError("Not Deflate (CM is $cm)") ;
-
- my $DICTID;
- if ($FDICT) {
- $self->smartReadExact(\$buffer, ZLIB_FDICT_SIZE)
- or return $self->TruncatedHeader("FDICT");
-
- $DICTID = unpack("N", $buffer) ;
- }
-
- *$self->{Type} = 'rfc1950';
-
- return {
- 'Type' => 'rfc1950',
- 'FingerprintLength' => ZLIB_HEADER_SIZE,
- 'HeaderLength' => ZLIB_HEADER_SIZE,
- 'TrailerLength' => ZLIB_TRAILER_SIZE,
- 'Header' => $buffer,
-
- CMF => $CMF ,
- CM => bits($CMF, ZLIB_CMF_CM_OFFSET, ZLIB_CMF_CM_BITS ),
- CINFO => bits($CMF, ZLIB_CMF_CINFO_OFFSET, ZLIB_CMF_CINFO_BITS ),
- FLG => $FLG ,
- FCHECK => bits($FLG, ZLIB_FLG_FCHECK_OFFSET, ZLIB_FLG_FCHECK_BITS),
- FDICT => bits($FLG, ZLIB_FLG_FDICT_OFFSET, ZLIB_FLG_FDICT_BITS ),
- FLEVEL => bits($FLG, ZLIB_FLG_LEVEL_OFFSET, ZLIB_FLG_LEVEL_BITS ),
- DICTID => $DICTID ,
-
- };
-}
-
-
-
-
1 ;
__END__
=head1 NAME
-IO::Uncompress::Inflate - Read RFC 1950 files/buffers
+IO::Uncompress::Bunzip2 - Read bzip2 files/buffers
=head1 SYNOPSIS
- use IO::Uncompress::Inflate qw(inflate $InflateError) ;
+ use IO::Uncompress::Bunzip2 qw(bunzip2 $Bunzip2Error) ;
- my $status = inflate $input => $output [,OPTS]
- or die "inflate failed: $InflateError\n";
+ my $status = bunzip2 $input => $output [,OPTS]
+ or die "bunzip2 failed: $Bunzip2Error\n";
- my $z = new IO::Uncompress::Inflate $input [OPTS]
- or die "inflate failed: $InflateError\n";
+ my $z = new IO::Uncompress::Bunzip2 $input [OPTS]
+ or die "bunzip2 failed: $Bunzip2Error\n";
$status = $z->read($buffer)
$status = $z->read($buffer, $length)
$char = $z->ungetc()
$char = $z->opened()
- $status = $z->inflateSync()
-
$data = $z->trailingData()
$status = $z->nextStream()
$data = $z->getHeaderInfo()
$z->eof()
$z->close()
- $InflateError ;
+ $Bunzip2Error ;
# IO::File mode
=head1 DESCRIPTION
This module provides a Perl interface that allows the reading of
-files/buffers that conform to RFC 1950.
+bzip2 files/buffers.
-For writing RFC 1950 files/buffers, see the companion module IO::Compress::Deflate.
+For writing bzip2 files/buffers, see the companion module IO::Compress::Bzip2.
=head1 Functional Interface
-A top-level function, C<inflate>, is provided to carry out
+A top-level function, C<bunzip2>, is provided to carry out
"one-shot" uncompression between buffers and/or files. For finer
control over the uncompression process, see the L</"OO Interface">
section.
- use IO::Uncompress::Inflate qw(inflate $InflateError) ;
+ use IO::Uncompress::Bunzip2 qw(bunzip2 $Bunzip2Error) ;
- inflate $input => $output [,OPTS]
- or die "inflate failed: $InflateError\n";
+ bunzip2 $input => $output [,OPTS]
+ or die "bunzip2 failed: $Bunzip2Error\n";
The functional interface needs Perl5.005 or better.
-=head2 inflate $input => $output [, OPTS]
+=head2 bunzip2 $input => $output [, OPTS]
-C<inflate> expects at least two parameters, C<$input> and C<$output>.
+C<bunzip2> expects at least two parameters, C<$input> and C<$output>.
=head3 The C<$input> parameter
=item An Input FileGlob string
If C<$input> is a string that is delimited by the characters "<" and ">"
-C<inflate> will assume that it is an I<input fileglob string>. The
+C<bunzip2> will assume that it is an I<input fileglob string>. The
input is the list of files that match the fileglob.
If the fileglob does not match any files ...
=item An Output FileGlob
If C<$output> is a string that is delimited by the characters "<" and ">"
-C<inflate> will assume that it is an I<output fileglob string>. The
+C<bunzip2> will assume that it is an I<output fileglob string>. The
output is the list of files that match the fileglob.
When C<$output> is an fileglob string, C<$input> must also be a fileglob
=head2 Optional Parameters
-Unless specified below, the optional parameters for C<inflate>,
+Unless specified below, the optional parameters for C<bunzip2>,
C<OPTS>, are the same as those used with the OO interface defined in the
L</"Constructor Options"> section below.
=item C<< AutoClose => 0|1 >>
This option applies to any input or output data streams to
-C<inflate> that are filehandles.
+C<bunzip2> that are filehandles.
If C<AutoClose> is specified, and the value is true, it will result in all
-input and/or output filehandles being closed once C<inflate> has
+input and/or output filehandles being closed once C<bunzip2> has
completed.
This parameter defaults to 0.
=head2 Examples
-To read the contents of the file C<file1.txt.1950> and write the
+To read the contents of the file C<file1.txt.bz2> and write the
compressed data to the file C<file1.txt>.
use strict ;
use warnings ;
- use IO::Uncompress::Inflate qw(inflate $InflateError) ;
+ use IO::Uncompress::Bunzip2 qw(bunzip2 $Bunzip2Error) ;
- my $input = "file1.txt.1950";
+ my $input = "file1.txt.bz2";
my $output = "file1.txt";
- inflate $input => $output
- or die "inflate failed: $InflateError\n";
+ bunzip2 $input => $output
+ or die "bunzip2 failed: $Bunzip2Error\n";
To read from an existing Perl filehandle, C<$input>, and write the
uncompressed data to a buffer, C<$buffer>.
use strict ;
use warnings ;
- use IO::Uncompress::Inflate qw(inflate $InflateError) ;
+ use IO::Uncompress::Bunzip2 qw(bunzip2 $Bunzip2Error) ;
use IO::File ;
- my $input = new IO::File "<file1.txt.1950"
- or die "Cannot open 'file1.txt.1950': $!\n" ;
+ my $input = new IO::File "<file1.txt.bz2"
+ or die "Cannot open 'file1.txt.bz2': $!\n" ;
my $buffer ;
- inflate $input => \$buffer
- or die "inflate failed: $InflateError\n";
+ bunzip2 $input => \$buffer
+ or die "bunzip2 failed: $Bunzip2Error\n";
-To uncompress all files in the directory "/my/home" that match "*.txt.1950" and store the compressed data in the same directory
+To uncompress all files in the directory "/my/home" that match "*.txt.bz2" and store the compressed data in the same directory
use strict ;
use warnings ;
- use IO::Uncompress::Inflate qw(inflate $InflateError) ;
+ use IO::Uncompress::Bunzip2 qw(bunzip2 $Bunzip2Error) ;
- inflate '</my/home/*.txt.1950>' => '</my/home/#1.txt>'
- or die "inflate failed: $InflateError\n";
+ bunzip2 '</my/home/*.txt.bz2>' => '</my/home/#1.txt>'
+ or die "bunzip2 failed: $Bunzip2Error\n";
and if you want to compress each file one at a time, this will do the trick
use strict ;
use warnings ;
- use IO::Uncompress::Inflate qw(inflate $InflateError) ;
+ use IO::Uncompress::Bunzip2 qw(bunzip2 $Bunzip2Error) ;
- for my $input ( glob "/my/home/*.txt.1950" )
+ for my $input ( glob "/my/home/*.txt.bz2" )
{
my $output = $input;
- $output =~ s/.1950// ;
- inflate $input => $output
- or die "Error compressing '$input': $InflateError\n";
+ $output =~ s/.bz2// ;
+ bunzip2 $input => $output
+ or die "Error compressing '$input': $Bunzip2Error\n";
}
=head1 OO Interface
=head2 Constructor
-The format of the constructor for IO::Uncompress::Inflate is shown below
+The format of the constructor for IO::Uncompress::Bunzip2 is shown below
- my $z = new IO::Uncompress::Inflate $input [OPTS]
- or die "IO::Uncompress::Inflate failed: $InflateError\n";
+ my $z = new IO::Uncompress::Bunzip2 $input [OPTS]
+ or die "IO::Uncompress::Bunzip2 failed: $Bunzip2Error\n";
-Returns an C<IO::Uncompress::Inflate> object on success and undef on failure.
-The variable C<$InflateError> will contain an error message on failure.
+Returns an C<IO::Uncompress::Bunzip2> object on success and undef on failure.
+The variable C<$Bunzip2Error> will contain an error message on failure.
If you are running Perl 5.005 or better the object, C<$z>, returned from
-IO::Uncompress::Inflate can be used exactly like an L<IO::File|IO::File> filehandle.
+IO::Uncompress::Bunzip2 can be used exactly like an L<IO::File|IO::File> filehandle.
This means that all normal input file operations can be carried out with
C<$z>. For example, to read a line from a compressed file/buffer you can
use either of these forms
This option is only valid when the C<$input> parameter is a filehandle. If
specified, and the value is true, it will result in the file being closed once
-either the C<close> method is called or the IO::Uncompress::Inflate object is
+either the C<close> method is called or the IO::Uncompress::Bunzip2 object is
destroyed.
This parameter defaults to 0.
=item C<< BlockSize => $num >>
-When reading the compressed input data, IO::Uncompress::Inflate will read it in
+When reading the compressed input data, IO::Uncompress::Bunzip2 will read it in
blocks of C<$num> bytes.
This option defaults to 4096.
=item C<< Strict => 0|1 >>
-This option controls whether the extra checks defined below are used when
-carrying out the decompression. When Strict is on, the extra tests are
-carried out, when Strict is off they are not.
-
-The default for this option is off.
-
-=over 5
-
-=item 1
-
-The ADLER32 checksum field must be present.
+This option is a no-op.
-=item 2
+=item C<< Small => 0|1 >>
-The value of the ADLER32 field read must match the adler32 value of the
-uncompressed data actually contained in the file.
+When non-zero this options will make bzip2 use a decompression algorithm
+that uses less memory at the expense of increasing the amount of time
+taken for decompression.
-=back
+Default is 0.
=back
$char = $z->ungetc($string)
-=head2 inflateSync
-
-Usage is
-
- $status = $z->inflateSync()
-
-TODO
-
=head2 getHeaderInfo
Usage is
Closes the output file/buffer.
For most versions of Perl this method will be automatically invoked if
-the IO::Uncompress::Inflate object is destroyed (either explicitly or by the
+the IO::Uncompress::Bunzip2 object is destroyed (either explicitly or by the
variable with the reference to the object going out of scope). The
exceptions are Perl versions 5.005 through 5.00504 and 5.8.0. In
these cases, the C<close> method will be called automatically, but
Returns true on success, otherwise 0.
-If the C<AutoClose> option has been enabled when the IO::Uncompress::Inflate
+If the C<AutoClose> option has been enabled when the IO::Uncompress::Bunzip2
object was created, and the object is associated with a file, the
underlying file will also be closed.
=head1 Importing
-No symbolic constants are required by this IO::Uncompress::Inflate at present.
+No symbolic constants are required by this IO::Uncompress::Bunzip2 at present.
=over 5
=item :all
-Imports C<inflate> and C<$InflateError>.
+Imports C<bunzip2> and C<$Bunzip2Error>.
Same as doing this
- use IO::Uncompress::Inflate qw(inflate $InflateError) ;
+ use IO::Uncompress::Bunzip2 qw(bunzip2 $Bunzip2Error) ;
=back
=head2 Working with Net::FTP
-See L<IO::Uncompress::Inflate::FAQ|IO::Uncompress::Inflate::FAQ/"Compressed files and Net::FTP">
+See L<IO::Uncompress::Bunzip2::FAQ|IO::Uncompress::Bunzip2::FAQ/"Compressed files and Net::FTP">
=head1 SEE ALSO
-L<Compress::Zlib>, L<IO::Compress::Gzip>, L<IO::Uncompress::Gunzip>, L<IO::Compress::Deflate>, L<IO::Compress::RawDeflate>, L<IO::Uncompress::RawInflate>, L<IO::Compress::Bzip2>, L<IO::Uncompress::Bunzip2>, L<IO::Compress::Lzop>, L<IO::Uncompress::UnLzop>, L<IO::Compress::Lzf>, L<IO::Uncompress::UnLzf>, L<IO::Uncompress::AnyInflate>, L<IO::Uncompress::AnyUncompress>
+L<Compress::Zlib>, L<IO::Compress::Gzip>, L<IO::Uncompress::Gunzip>, L<IO::Compress::Deflate>, L<IO::Uncompress::Inflate>, L<IO::Compress::RawDeflate>, L<IO::Uncompress::RawInflate>, L<IO::Compress::Bzip2>, L<IO::Compress::Lzop>, L<IO::Uncompress::UnLzop>, L<IO::Compress::Lzf>, L<IO::Uncompress::UnLzf>, L<IO::Uncompress::AnyInflate>, L<IO::Uncompress::AnyUncompress>
L<Compress::Zlib::FAQ|Compress::Zlib::FAQ>
L<Archive::Tar|Archive::Tar>,
L<IO::Zlib|IO::Zlib>
-For RFC 1950, 1951 and 1952 see
-F<http://www.faqs.org/rfcs/rfc1950.html>,
-F<http://www.faqs.org/rfcs/rfc1951.html> and
-F<http://www.faqs.org/rfcs/rfc1952.html>
-
-The I<zlib> compression library was written by Jean-loup Gailly
-F<gzip@prep.ai.mit.edu> and Mark Adler F<madler@alumni.caltech.edu>.
-
-The primary site for the I<zlib> compression library is
-F<http://www.zlib.org>.
+The primary site for the bzip2 program is F<http://www.bzip.org>.
-The primary site for gzip is F<http://www.gzip.org>.
+See the module L<Compress::Bzip2|Compress::Bzip2>
=head1 AUTHOR
use warnings;
use bytes;
-use IO::Uncompress::RawInflate 2.015 ;
+use IO::Uncompress::RawInflate 2.017 ;
-use Compress::Raw::Zlib 2.015 qw( crc32 ) ;
-use IO::Compress::Base::Common 2.015 qw(:Status createSelfTiedObject);
-use IO::Compress::Gzip::Constants 2.015 ;
-use IO::Compress::Zlib::Extra 2.015 ;
+use Compress::Raw::Zlib 2.017 qw( crc32 ) ;
+use IO::Compress::Base::Common 2.017 qw(:Status createSelfTiedObject);
+use IO::Compress::Gzip::Constants 2.017 ;
+use IO::Compress::Zlib::Extra 2.017 ;
require Exporter ;
$GunzipError = '';
-$VERSION = '2.015';
+$VERSION = '2.017';
sub new
{
sub getExtraParams
{
- use IO::Compress::Base::Common 2.015 qw(:Parse);
+ use IO::Compress::Base::Common 2.017 qw(:Parse);
return ( 'ParseExtra' => [1, 1, Parse_boolean, 0] ) ;
}
=head1 COPYRIGHT AND LICENSE
-Copyright (c) 2005-2008 Paul Marquess. All rights reserved.
+Copyright (c) 2005-2009 Paul Marquess. All rights reserved.
This program is free software; you can redistribute it and/or
modify it under the same terms as Perl itself.
use warnings;
use bytes;
-use IO::Compress::Base::Common 2.015 qw(:Status createSelfTiedObject);
-use IO::Compress::Zlib::Constants 2.015 ;
+use IO::Compress::Base::Common 2.017 qw(:Status createSelfTiedObject);
+use IO::Compress::Zlib::Constants 2.017 ;
-use IO::Uncompress::RawInflate 2.015 ;
+use IO::Uncompress::RawInflate 2.017 ;
require Exporter ;
our ($VERSION, @ISA, @EXPORT_OK, %EXPORT_TAGS, $InflateError);
-$VERSION = '2.015';
+$VERSION = '2.017';
$InflateError = '';
@ISA = qw( Exporter IO::Uncompress::RawInflate );
=head1 COPYRIGHT AND LICENSE
-Copyright (c) 2005-2008 Paul Marquess. All rights reserved.
+Copyright (c) 2005-2009 Paul Marquess. All rights reserved.
This program is free software; you can redistribute it and/or
modify it under the same terms as Perl itself.
use warnings;
use bytes;
-use Compress::Raw::Zlib 2.015 ;
-use IO::Compress::Base::Common 2.015 qw(:Status createSelfTiedObject);
-
-use IO::Uncompress::Base 2.015 ;
-use IO::Uncompress::Adapter::Inflate 2.015 ;
-
-
+use Compress::Raw::Zlib 2.017 ;
+use IO::Compress::Base::Common 2.017 qw(:Status createSelfTiedObject);
+use IO::Uncompress::Base 2.017 ;
+use IO::Uncompress::Adapter::Inflate 2.017 ;
require Exporter ;
our ($VERSION, @ISA, @EXPORT_OK, %EXPORT_TAGS, %DEFLATE_CONSTANTS, $RawInflateError);
-$VERSION = '2.015';
+$VERSION = '2.017';
$RawInflateError = '';
@ISA = qw( Exporter IO::Uncompress::Base );
push @{ $EXPORT_TAGS{all} }, @EXPORT_OK ;
Exporter::export_ok_tags('all');
-
+#{
+# # Execute at runtime
+# my %bad;
+# for my $module (qw(Compress::Raw::Zlib IO::Compress::Base::Common IO::Uncompress::Base IO::Uncompress::Adapter::Inflate))
+# {
+# my $ver = ${ $module . "::VERSION"} ;
+#
+# $bad{$module} = $ver
+# if $ver ne $VERSION;
+# }
+#
+# if (keys %bad)
+# {
+# my $string = join "\n", map { "$_ $bad{$_}" } keys %bad;
+# die caller(0)[0] . "needs version $VERSION mismatch\n$string\n";
+# }
+#}
sub new
{
*$self->{HeaderPending} = $temp_buf ;
$buffer = '';
my $status = *$self->{Uncomp}->uncompr(\$temp_buf, \$buffer, $self->smartEof()) ;
+
return $self->saveErrorString(undef, *$self->{Uncomp}{Error}, STATUS_ERROR)
if $status == STATUS_ERROR;
+ $self->pushBack($temp_buf) ;
+
+ return $self->saveErrorString(undef, "unexpected end of file", STATUS_ERROR)
+ if $self->smartEof() && $status != STATUS_ENDSTREAM;
+
#my $buf_len = *$self->{Uncomp}->uncompressedBytes();
my $buf_len = length $buffer;
&& (length $temp_buf || ! $self->smartEof())){
*$self->{NewStream} = 1 ;
*$self->{EndStream} = 0 ;
- $self->pushBack($temp_buf);
}
else {
*$self->{EndStream} = 1 ;
- $self->pushBack($temp_buf);
}
}
*$self->{HeaderPending} = $buffer ;
=head1 COPYRIGHT AND LICENSE
-Copyright (c) 2005-2008 Paul Marquess. All rights reserved.
+Copyright (c) 2005-2009 Paul Marquess. All rights reserved.
This program is free software; you can redistribute it and/or
modify it under the same terms as Perl itself.
use warnings;
use bytes;
-use IO::Uncompress::RawInflate 2.015 ;
-use IO::Compress::Base::Common 2.015 qw(:Status createSelfTiedObject);
-use IO::Uncompress::Adapter::Inflate 2.015 ;
-use IO::Uncompress::Adapter::Identity 2.015 ;
-use IO::Compress::Zlib::Extra 2.015 ;
-use IO::Compress::Zip::Constants 2.015 ;
+use IO::Uncompress::RawInflate 2.017 ;
+use IO::Compress::Base::Common 2.017 qw(:Status createSelfTiedObject);
+use IO::Uncompress::Adapter::Inflate 2.017 ;
+use IO::Uncompress::Adapter::Identity 2.017 ;
+use IO::Compress::Zlib::Extra 2.017 ;
+use IO::Compress::Zip::Constants 2.017 ;
-use Compress::Raw::Zlib 2.015 qw(crc32) ;
+use Compress::Raw::Zlib 2.017 qw(crc32) ;
BEGIN
{
eval { require IO::Uncompress::Adapter::Bunzip2 ;
import IO::Uncompress::Adapter::Bunzip2 } ;
+ #eval { require IO::Uncompress::Adapter::UnLzma ;
+ # import IO::Uncompress::Adapter::UnLzma } ;
}
our ($VERSION, @ISA, @EXPORT_OK, %EXPORT_TAGS, $UnzipError, %headerLookup);
-$VERSION = '2.015';
+$VERSION = '2.017';
$UnzipError = '';
@ISA = qw(Exporter IO::Uncompress::RawInflate);
sub getExtraParams
{
- use IO::Compress::Base::Common 2.015 qw(:Parse);
+ use IO::Compress::Base::Common 2.017 qw(:Parse);
return (
*$self->{Uncomp} = $obj;
*$self->{ZipData}{CRC32} = crc32(undef);
}
+# elsif ($compressedMethod == ZIP_CM_LZMA)
+# {
+# return $self->HeaderError("Unsupported Compression format $compressedMethod")
+# if ! defined $IO::Uncompress::Adapter::UnLzma::VERSION ;
+#
+# *$self->{Type} = 'zip-lzma';
+#
+# my $obj = IO::Uncompress::Adapter::UnLzma::mkUncompObject();
+#
+# *$self->{Uncomp} = $obj;
+# *$self->{ZipData}{CRC32} = crc32(undef);
+# }
elsif ($compressedMethod == ZIP_CM_STORE)
{
# TODO -- add support for reading uncompressed
See L<IO::Uncompress::Unzip::FAQ|IO::Uncompress::Unzip::FAQ/"Compressed files and Net::FTP">
-=head2 Walking through a zip file
-
-The code below can be used to traverse a zip file, one compressed data
-stream at a time.
-
- use IO::Uncompress::Unzip qw($UnzipError);
-
- my $zipfile = "somefile.zip";
- my $u = new IO::Uncompress::Unzip $zipfile
- or die "Cannot open $zipfile: $UnzipError";
-
- my $status;
- for ($status = 1; ! $u->eof(); $status = $u->nextStream())
- {
-
- my $name = $u->getHeaderInfo()->{Name};
- warn "Processing member $name\n" ;
-
- my $buff;
- while (($status = $u->read($buff)) > 0) {
- # Do something here
- }
-
- last unless $status == 0;
- }
-
- die "Error processing $zipfile: $!\n"
- if $status < 0 ;
-
-Each individual compressed data stream is read until the logical
-end-of-file is reached. Then C<nextStream> is called. This will skip to the
-start of the next compressed data stream and clear the end-of-file flag.
-
-It is also worth noting that C<nextStream> can be called at any time -- you
-don't have to wait until you have exhausted a compressed data stream before
-skipping to the next one.
-
=head1 SEE ALSO
L<Compress::Zlib>, L<IO::Compress::Gzip>, L<IO::Uncompress::Gunzip>, L<IO::Compress::Deflate>, L<IO::Uncompress::Inflate>, L<IO::Compress::RawDeflate>, L<IO::Uncompress::RawInflate>, L<IO::Compress::Bzip2>, L<IO::Uncompress::Bunzip2>, L<IO::Compress::Lzop>, L<IO::Uncompress::UnLzop>, L<IO::Compress::Lzf>, L<IO::Uncompress::UnLzf>, L<IO::Uncompress::AnyInflate>, L<IO::Uncompress::AnyUncompress>
=head1 COPYRIGHT AND LICENSE
-Copyright (c) 2005-2008 Paul Marquess. All rights reserved.
+Copyright (c) 2005-2009 Paul Marquess. All rights reserved.
This program is free software; you can redistribute it and/or
modify it under the same terms as Perl itself.
=head1 NAME
-IO::Compress::Zlib::FAQ -- Frequently Asked Questions about IO::Compress::Zlib
+IO::Compress::FAQ -- Frequently Asked Questions about IO::Compress
=head1 DESCRIPTION
=head2 Compatibility with Unix compress/uncompress.
-This module is not compatible with Unix C<compress>.
+Although C<Compress::Zlib> has a pair of functions called C<compress> and
+C<uncompress>, they are I<not> related to the Unix programs of the same
+name. The C<Compress::Zlib> module is not compatible with Unix
+C<compress>.
If you have the C<uncompress> program available, you can use this to read
compressed files
=head2 Accessing .tar.Z files
-See previous FAQ item.
+The C<Archive::Tar> module can optionally use C<Compress::Zlib> (via the
+C<IO::Zlib> module) to access tar files that have been compressed with
+C<gzip>. Unfortunately tar files compressed with the Unix C<compress>
+utility cannot be read by C<Compress::Zlib> and so cannot be directly
+accessed by C<Archive::Tar>.
-If the C<Archive::Tar> module is installed and either the C<uncompress> or
-C<gunzip> programs are available, you can use one of these workarounds to
-read C<.tar.Z> files.
+If the C<uncompress> or C<gunzip> programs are available, you can use one
+of these workarounds to read C<.tar.Z> files from C<Archive::Tar>
Firstly with C<uncompress>
=head1 COPYRIGHT AND LICENSE
-Copyright (c) 2005-2008 Paul Marquess. All rights reserved.
+Copyright (c) 2005-2009 Paul Marquess. All rights reserved.
This program is free software; you can redistribute it and/or
modify it under the same terms as Perl itself.
--- /dev/null
+BEGIN {
+ if ($ENV{PERL_CORE}) {
+ chdir 't' if -d 't';
+ @INC = ("../lib", "lib/compress");
+ }
+}
+
+use lib qw(t t/compress);
+use strict ;
+use warnings ;
+
+use Test::More ;
+
+BEGIN
+{
+ # use Test::NoWarnings, if available
+ my $extra = 0 ;
+ $extra = 1
+ if eval { require Test::NoWarnings ; import Test::NoWarnings; 1 };
+
+
+ my $VERSION = '2.016';
+ my @NAMES = qw(
+ Compress::Raw::Bzip2
+ Compress::Raw::Zlib
+ );
+
+ my @OPT = qw(
+
+ );
+
+ plan tests => @NAMES + @OPT + $extra ;
+
+ foreach my $name (@NAMES)
+ {
+ use_ok($name, $VERSION);
+ }
+
+
+ foreach my $name (@OPT)
+ {
+ eval " require $name " ;
+ if ($@)
+ {
+ ok 1, "$name not available"
+ }
+ else
+ {
+ my $ver = eval("\$${name}::VERSION");
+ is $ver, $VERSION, "$name version should be $VERSION"
+ or diag "$name version is $ver, need $VERSION" ;
+ }
+ }
+
+}
+
--- /dev/null
+BEGIN {
+ if ($ENV{PERL_CORE}) {
+ chdir 't' if -d 't';
+ @INC = ("../lib", "lib/compress");
+ }
+}
+
+use lib qw(t t/compress);
+
+use strict;
+use warnings;
+use bytes;
+
+use Test::More ;
+use CompTestUtils;
+
+BEGIN
+{
+ # use Test::NoWarnings, if available
+ my $extra = 0 ;
+ $extra = 1
+ if eval { require Test::NoWarnings ; import Test::NoWarnings; 1 };
+
+ plan tests => 841 + $extra ;
+};
+
+
+use IO::Compress::Bzip2 qw($Bzip2Error) ;
+use IO::Uncompress::Bunzip2 qw($Bunzip2Error) ;
+
+
+my $CompressClass = 'IO::Compress::Bzip2';
+my $UncompressClass = getInverse($CompressClass);
+my $Error = getErrorRef($CompressClass);
+my $UnError = getErrorRef($UncompressClass);
+
+sub myBZreadFile
+{
+ my $filename = shift ;
+ my $init = shift ;
+
+
+ my $fil = new $UncompressClass $filename,
+ -Strict => 1,
+ -Append => 1
+ ;
+
+ my $data = '';
+ $data = $init if defined $init ;
+ 1 while $fil->read($data) > 0;
+
+ $fil->close ;
+ return $data ;
+}
+
+
+{
+
+ title "Testing $CompressClass Errors";
+
+ my $buffer ;
+
+ for my $value (undef, -1, 'fred')
+ {
+ my $stringValue = defined $value ? $value : 'undef';
+ title "BlockSize100K => $stringValue";
+ my $err = "Parameter 'BlockSize100K' must be an unsigned int, got '$stringValue'";
+ my $bz ;
+ eval { $bz = new IO::Compress::Bzip2(\$buffer, BlockSize100K => $value) };
+ like $@, mkErr("IO::Compress::Bzip2: $err"),
+ " value $stringValue is bad";
+ is $Bzip2Error, "IO::Compress::Bzip2: $err",
+ " value $stringValue is bad";
+ ok ! $bz, " no bz object";
+ }
+
+ for my $value (0, 10, 99999)
+ {
+ my $stringValue = defined $value ? $value : 'undef';
+ title "BlockSize100K => $stringValue";
+ my $err = "Parameter 'BlockSize100K' not between 1 and 9, got $stringValue";
+ my $bz ;
+ eval { $bz = new IO::Compress::Bzip2(\$buffer, BlockSize100K => $value) };
+ like $@, mkErr("IO::Compress::Bzip2: $err"),
+ " value $stringValue is bad";
+ is $Bzip2Error, "IO::Compress::Bzip2: $err",
+ " value $stringValue is bad";
+ ok ! $bz, " no bz object";
+ }
+
+ for my $value (undef, -1, 'fred')
+ {
+ my $stringValue = defined $value ? $value : 'undef';
+ title "WorkFactor => $stringValue";
+ my $err = "Parameter 'WorkFactor' must be an unsigned int, got '$stringValue'";
+ my $bz ;
+ eval { $bz = new IO::Compress::Bzip2(\$buffer, WorkFactor => $value) };
+ like $@, mkErr("IO::Compress::Bzip2: $err"),
+ " value $stringValue is bad";
+ is $Bzip2Error, "IO::Compress::Bzip2: $err",
+ " value $stringValue is bad";
+ ok ! $bz, " no bz object";
+ }
+
+ for my $value (251, 99999)
+ {
+ my $stringValue = defined $value ? $value : 'undef';
+ title "WorkFactor => $stringValue";
+ my $err = "Parameter 'WorkFactor' not between 0 and 250, got $stringValue";
+ my $bz ;
+ eval { $bz = new IO::Compress::Bzip2(\$buffer, WorkFactor => $value) };
+ like $@, mkErr("IO::Compress::Bzip2: $err"),
+ " value $stringValue is bad";
+ is $Bzip2Error, "IO::Compress::Bzip2: $err",
+ " value $stringValue is bad";
+ ok ! $bz, " no bz object";
+ }
+
+}
+
+
+{
+ title "Testing $UncompressClass Errors";
+
+ my $buffer ;
+
+ for my $value (-1, 'fred')
+ {
+ my $stringValue = defined $value ? $value : 'undef';
+ title "Small => $stringValue";
+ my $err = "Parameter 'Small' must be an int, got '$stringValue'";
+ my $bz ;
+ eval { $bz = new IO::Uncompress::Bunzip2(\$buffer, Small => $value) };
+ like $@, mkErr("IO::Uncompress::Bunzip2: $err"),
+ " value $stringValue is bad";
+ is $Bunzip2Error, "IO::Uncompress::Bunzip2: $err",
+ " value $stringValue is bad";
+ ok ! $bz, " no bz object";
+ }
+
+}
+
+{
+ title "Testing $CompressClass and $UncompressClass";
+
+ my $hello = <<EOM ;
+hello world
+this is a test
+EOM
+
+ for my $value ( 1 .. 9 )
+ {
+ title "$CompressClass - BlockSize100K => $value";
+ my $lex = new LexFile my $name ;
+ my $bz ;
+ $bz = new IO::Compress::Bzip2($name, BlockSize100K => $value)
+ or diag $IO::Compress::Bzip2::Bzip2Error ;
+ ok $bz, " bz object ok";
+ $bz->write($hello);
+ $bz->close($hello);
+
+ is myBZreadFile($name), $hello, " got expected content";
+ }
+
+ for my $value ( 0 .. 250 )
+ {
+ title "$CompressClass - WorkFactor => $value";
+ my $lex = new LexFile my $name ;
+ my $bz ;
+ $bz = new IO::Compress::Bzip2($name, WorkFactor => $value);
+ ok $bz, " bz object ok";
+ $bz->write($hello);
+ $bz->close($hello);
+
+ is myBZreadFile($name), $hello, " got expected content";
+ }
+
+ for my $value ( 0 .. 1 )
+ {
+ title "$UncompressClass - Small => $value";
+ my $lex = new LexFile my $name ;
+ my $bz ;
+ $bz = new IO::Compress::Bzip2($name);
+ ok $bz, " bz object ok";
+ $bz->write($hello);
+ $bz->close($hello);
+
+ my $fil = new $UncompressClass $name,
+ Append => 1,
+ Small => $value ;
+
+ my $data = '';
+ 1 while $fil->read($data) > 0;
+
+ $fil->close ;
+
+ is $data, $hello, " got expected";
+ }
+}
+
+
+1;
+
+
+
+
use Test::More ;
use CompTestUtils;
-use IO::Compress::Gzip 'gzip' ;
+use IO::Compress::Bzip2 'bzip2' ;
BEGIN
{
$Perl = "$Perl $Inc -w" ;
#$Perl .= " -Mblib " ;
-my $examples = $ENV{PERL_CORE} ? "../ext/Compress-Zlib/examples"
- : "./examples";
+my $examples = $ENV{PERL_CORE} ? "../ext/IO-Compress/examples/io/bzip2"
+ : "./examples/io/bzip2";
my $hello1 = <<EOM ;
hello
for ($file1, $file2, $stderr) { 1 while unlink $_ } ;
-gzip \$hello1 => $file1 ;
-gzip \$hello2 => $file2 ;
+bzip2 \$hello1 => $file1 ;
+bzip2 \$hello2 => $file2 ;
sub check
{
1 while unlink $stderr;
}
-# gzcat
+# bzcat
# #####
-title "gzcat - command line" ;
-check "$Perl ${examples}/gzcat $file1 $file2", $hello1 . $hello2;
+title "bzcat - command line" ;
+check "$Perl ${examples}/bzcat $file1 $file2", $hello1 . $hello2;
-title "gzcat - stdin" ;
-check "$Perl ${examples}/gzcat <$file1 ", $hello1;
+title "bzcat - stdin" ;
+check "$Perl ${examples}/bzcat <$file1 ", $hello1;
-# gzgrep
+# bzgrep
# ######
-title "gzgrep";
-check "$Perl ${examples}/gzgrep the $file1 $file2",
+title "bzgrep";
+check "$Perl ${examples}/bzgrep the $file1 $file2",
join('', grep(/the/, @hello1, @hello2));
for ($file1, $file2, $stderr) { 1 while unlink $_ } ;
-# gzstream
+# bzstream
# ########
{
- title "gzstream" ;
+ title "bzstream" ;
writeFile($file1, $hello1) ;
- check "$Perl ${examples}/gzstream <$file1 >$file2";
+ check "$Perl ${examples}/bzstream <$file1 >$file2";
- title "gzcat" ;
- check "$Perl ${examples}/gzcat $file2", $hello1 ;
+ title "bzcat" ;
+ check "$Perl ${examples}/bzcat $file2", $hello1 ;
}
END
$Perl = "$Perl $Inc -w" ;
#$Perl .= " -Mblib " ;
-my $examples = $ENV{PERL_CORE} ? "../ext/Compress-Zlib/examples"
- : "./examples";
+my $examples = $ENV{PERL_CORE} ? "../ext/IO-Compress/examples/io/gzip"
+ : "./examples/io/gzip";
my $hello1 = <<EOM ;
hello
use strict;
use warnings;
-use IO::Compress::Zip qw($ZipError) ;
-use IO::Uncompress::Unzip qw($UnzipError) ;
+use IO::Compress::Bzip2 qw($Bzip2Error) ;
+use IO::Uncompress::Bunzip2 qw($Bunzip2Error) ;
sub identify
{
- 'IO::Compress::Zip';
+ 'IO::Compress::Bzip2';
}
require "generic.pl" ;
use strict;
use warnings;
-#use Test::More skip_all => "not implemented yet";
use Test::More ;
BEGIN {
$extra = 1
if eval { require Test::NoWarnings ; import Test::NoWarnings; 1 };
- plan tests => 2316 + $extra;
+ plan tests => 912 + $extra;
};
+#use Test::More skip_all => "not implemented yet";
-
-use IO::Compress::Zip qw($ZipError) ;
-use IO::Uncompress::Unzip qw($UnzipError) ;
+use IO::Compress::Bzip2 qw($Bzip2Error) ;
+use IO::Uncompress::Bunzip2 qw($Bunzip2Error) ;
sub identify
{
- 'IO::Compress::Zip';
+ 'IO::Compress::Bzip2';
}
require "truncate.pl" ;
-Transparent => 0))
or diag "$$Error\n";
my $un;
- ok $gz->read($un) > 0 ;
+ is $gz->read($un, length($hello)), length($hello);
ok $gz->close();
- ok $un eq $hello ;
+ is $un, $hello ;
for my $trans (0 .. 1)
{
ok $gz;
ok ! $gz->error() ;
my $buff = '';
- is $gz->read($buff), length $part ;
+ is $gz->read($buff, length $part), length $part ;
is $buff, $part ;
ok $gz->eof() ;
$gz->close();
use strict;
use warnings;
-use IO::Compress::Zip qw($ZipError) ;
-use IO::Uncompress::Unzip qw($UnzipError) ;
+use IO::Compress::Bzip2 qw($Bzip2Error) ;
+use IO::Uncompress::Bunzip2 qw($Bunzip2Error) ;
sub identify
{
- 'IO::Compress::Zip';
+ 'IO::Compress::Bzip2';
}
require "tied.pl" ;
use strict;
use warnings;
-use IO::Compress::Gzip qw($GzipError) ;
-use IO::Uncompress::Gunzip qw($GunzipError) ;
+use IO::Compress::Bzip2 qw($Bzip2Error) ;
+use IO::Uncompress::Bunzip2 qw($Bunzip2Error) ;
sub identify
{
- 'IO::Compress::Gzip';
+ 'IO::Compress::Bzip2';
}
require "newtied.pl" ;
use strict;
use warnings;
-use IO::Compress::Gzip qw($GzipError) ;
-use IO::Uncompress::Gunzip qw($GunzipError) ;
+use IO::Compress::Bzip2 qw($Bzip2Error) ;
+use IO::Uncompress::Bunzip2 qw($Bunzip2Error) ;
sub identify
{
- 'IO::Compress::Gzip';
+ 'IO::Compress::Bzip2';
}
require "destroy.pl" ;
use strict;
use warnings;
-use IO::Compress::Gzip qw($GzipError) ;
-use IO::Uncompress::Gunzip qw($GunzipError) ;
+use IO::Compress::Bzip2 qw($Bzip2Error) ;
+use IO::Uncompress::Bunzip2 qw($Bunzip2Error) ;
sub identify
{
- 'IO::Compress::Gzip';
+ 'IO::Compress::Bzip2';
}
require "oneshot.pl" ;
+
run();
}
require "oneshot.pl" ;
+
run();
plan(skip_all => "oneshot needs Perl 5.005 or better - you have Perl $]" )
if $] < 5.005 ;
+ plan(skip_all => "IO::Compress::Bzip2 not available" )
+ unless eval { require IO::Compress::Bzip2;
+ require IO::Uncompress::Bunzip2;
+ 1
+ } ;
# use Test::NoWarnings, if available
my $extra = 0 ;
$extra = 1
if eval { require Test::NoWarnings ; import Test::NoWarnings; 1 };
- plan tests => 146 + $extra ;
+ plan tests => 120 + $extra ;
#use_ok('IO::Compress::Zip', qw(zip $ZipError :zip_method)) ;
use_ok('IO::Compress::Zip', qw(:all)) ;
}
-{
- title "Check zip header default NAME & MTIME settings" ;
-
- my $lex = new LexFile my $file1;
-
- my $content = "hello ";
- my $hdr ;
- my $mtime ;
-
- writeFile($file1, $content);
- $mtime = (stat($file1))[9];
- # make sure that the zip file isn't created in the same
- # second as the input file
- sleep 3 ;
- $hdr = zipGetHeader($file1, $content);
-
- is $hdr->{Name}, $file1, " Name is '$file1'";
- is $hdr->{Time}>>1, $mtime>>1, " Time is ok";
-
- title "Override Name" ;
-
- writeFile($file1, $content);
- $mtime = (stat($file1))[9];
- sleep 3 ;
- $hdr = zipGetHeader($file1, $content, Name => "abcde");
-
- is $hdr->{Name}, "abcde", " Name is 'abcde'" ;
- is $hdr->{Time} >> 1, $mtime >> 1, " Time is ok";
-
- title "Override Time" ;
-
- writeFile($file1, $content);
- my $useTime = time + 2000 ;
- $hdr = zipGetHeader($file1, $content, Time => $useTime);
-
- is $hdr->{Name}, $file1, " Name is '$file1'" ;
- is $hdr->{Time} >> 1 , $useTime >> 1 , " Time is $useTime";
-
- title "Override Name and Time" ;
-
- $useTime = time + 5000 ;
- writeFile($file1, $content);
- $hdr = zipGetHeader($file1, $content, Time => $useTime, Name => "abcde");
-
- is $hdr->{Name}, "abcde", " Name is 'abcde'" ;
- is $hdr->{Time} >> 1 , $useTime >> 1 , " Time is $useTime";
-
- title "Filehandle doesn't have default Name or Time" ;
- my $fh = new IO::File "< $file1"
- or diag "Cannot open '$file1': $!\n" ;
- sleep 3 ;
- my $before = time ;
- $hdr = zipGetHeader($fh, $content);
- my $after = time ;
-
- ok ! defined $hdr->{Name}, " Name is undef";
- cmp_ok $hdr->{Time} >> 1, '>=', $before >> 1, " Time is ok";
- cmp_ok $hdr->{Time} >> 1, '<=', $after >> 1, " Time is ok";
-
- $fh->close;
-
- title "Buffer doesn't have default Name or Time" ;
- my $buffer = $content;
- $before = time ;
- $hdr = zipGetHeader(\$buffer, $content);
- $after = time ;
-
- ok ! defined $hdr->{Name}, " Name is undef";
- cmp_ok $hdr->{Time} >> 1, '>=', $before >> 1, " Time is ok";
- cmp_ok $hdr->{Time} >> 1, '<=', $after >> 1, " Time is ok";
-}
for my $stream (0, 1)
{
{
next if $zip64 && ! $stream;
- for my $method (ZIP_CM_STORE, ZIP_CM_DEFLATE)
+ for my $method (ZIP_CM_STORE, ZIP_CM_DEFLATE, ZIP_CM_BZIP2)
{
-
title "Stream $stream, Zip64 $zip64, Method $method";
my $lex = new LexFile my $file1;
my $content = "hello ";
#writeFile($file1, $content);
- my $status = zip(\$content => $file1 ,
- Method => $method,
- Stream => $stream,
- Zip64 => $zip64);
-
- ok $status, " zip ok"
+ ok zip(\$content => $file1 , Method => $method,
+ Zip64 => $zip64,
+ Stream => $stream), " zip ok"
or diag $ZipError ;
my $got ;
for my $zip64 (0, 1)
{
next if $zip64 && ! $stream;
- for my $method (ZIP_CM_STORE, ZIP_CM_DEFLATE)
+
+ for my $method (ZIP_CM_STORE, ZIP_CM_DEFLATE, ZIP_CM_BZIP2)
{
title "Stream $stream, Zip64 $zip64, Method $method";
use strict;
use warnings;
-use IO::Compress::Gzip qw($GzipError) ;
-use IO::Uncompress::Gunzip qw($GunzipError) ;
+use IO::Compress::Bzip2 qw($Bzip2Error) ;
+use IO::Uncompress::Bunzip2 qw($Bunzip2Error) ;
sub identify
{
- 'IO::Compress::Gzip';
+ 'IO::Compress::Bzip2';
}
require "prime.pl" ;
use strict;
use warnings;
-use IO::Compress::Gzip qw($GzipError) ;
-use IO::Uncompress::Gunzip qw($GunzipError) ;
+use IO::Compress::Bzip2 qw($Bzip2Error) ;
+use IO::Uncompress::Bunzip2 qw($Bunzip2Error) ;
sub identify
{
- 'IO::Compress::Gzip';
+ 'IO::Compress::Bzip2';
}
require "multi.pl" ;
use IO::Uncompress::AnyUncompress qw($AnyUncompressError) ;
-use IO::Compress::Gzip qw($GzipError) ;
-use IO::Uncompress::Gunzip qw($GunzipError) ;
+use IO::Compress::Bzip2 qw($Bzip2Error) ;
+use IO::Uncompress::Bunzip2 qw($Bunzip2Error) ;
sub getClass
{
sub identify
{
- 'IO::Compress::Gzip';
+ 'IO::Compress::Bzip2';
}
require "any.pl" ;
use strict;
use warnings;
-use IO::Compress::Gzip qw($GzipError) ;
-use IO::Uncompress::Gunzip qw($GunzipError) ;
+use IO::Compress::Bzip2 qw($Bzip2Error) ;
+use IO::Uncompress::Bunzip2 qw($Bunzip2Error) ;
sub identify
{
- 'IO::Compress::Gzip';
+ 'IO::Compress::Bzip2';
}
require "encode.pl" ;
--- /dev/null
+BEGIN {
+ if ($ENV{PERL_CORE}) {
+ chdir 't' if -d 't';
+ @INC = ("../lib", "lib/compress");
+ }
+}
+
+use lib qw(t t/compress);
+use Test::More;
+
+eval "use Test::Pod 1.00";
+
+plan skip_all => "Test::Pod 1.00 required for testing POD" if $@;
+
+all_pod_files_ok();
+
--- /dev/null
+BEGIN {
+ if ($ENV{PERL_CORE}) {
+ chdir 't' if -d 't';
+ @INC = ("../lib", "lib/compress");
+ }
+}
+
+use lib qw(t t/compress);
+use Test::More;
+
+eval "use Test::Pod 1.00";
+
+plan skip_all => "Test::Pod 1.00 required for testing POD" if $@;
+
+all_pod_files_ok();
+
$Perl = qq["$Perl"] if $^O eq 'MSWin32' ;
$Perl = "$Perl $Inc -w" ;
-my $examples = $ENV{PERL_CORE} ? "../ext/Compress-Zlib/examples"
- : "./examples";
+my $examples = $ENV{PERL_CORE} ? "../ext/IO-Compress/examples/compress-zlib"
+ : "./examples/compress-zlib";
my $hello1 = <<EOM ;
hello
$extra = 1
if eval { require Test::NoWarnings ; import Test::NoWarnings; 1 };
- plan tests => 250 + $extra ;
+ plan tests => 255 + $extra ;
use_ok('Compress::Zlib', 2) ;
use_ok('IO::Compress::Gzip::Constants') ;
}
-
-my $hello = <<EOM ;
+{
+ # Check zlib_version and ZLIB_VERSION are the same.
+ is Compress::Zlib::zlib_version, ZLIB_VERSION,
+ "ZLIB_VERSION matches Compress::Zlib::zlib_version" ;
+}
+
+{
+ # gzip tests
+ #===========
+
+ #my $name = "test.gz" ;
+ my $lex = new LexFile my $name ;
+
+ my $hello = <<EOM ;
hello world
this is a test
EOM
-my $len = length $hello ;
-
-# Check zlib_version and ZLIB_VERSION are the same.
-is Compress::Zlib::zlib_version, ZLIB_VERSION,
- "ZLIB_VERSION matches Compress::Zlib::zlib_version" ;
-
-# gzip tests
-#===========
-
-my $name = "test.gz" ;
-my ($x, $uncomp) ;
-
-ok my $fil = gzopen($name, "wb") ;
-
-is $gzerrno, 0, 'gzerrno is 0';
-is $fil->gzerror(), 0, "gzerror() returned 0";
-
-is $fil->gztell(), 0, "gztell returned 0";
-is $gzerrno, 0, 'gzerrno is 0';
-
-is $fil->gzwrite($hello), $len ;
-is $gzerrno, 0, 'gzerrno is 0';
-
-is $fil->gztell(), $len, "gztell returned $len";
-is $gzerrno, 0, 'gzerrno is 0';
-
-ok ! $fil->gzclose ;
-
-ok $fil = gzopen($name, "rb") ;
-
-ok ! $fil->gzeof() ;
-is $gzerrno, 0, 'gzerrno is 0';
-is $fil->gztell(), 0;
-
-is $fil->gzread($uncomp), $len;
-
-is $fil->gztell(), $len;
-ok $fil->gzeof() ;
-
-# gzread after eof bahavior
-
-my $xyz = "123" ;
-is $fil->gzread($xyz), 0, "gzread returns 0 on eof" ;
-is $xyz, "", "gzread on eof zaps the output buffer [Match 1,x behavior]" ;
-
-ok ! $fil->gzclose ;
-ok $fil->gzeof() ;
-
-
-1 while unlink $name ;
-
-ok $hello eq $uncomp ;
-
-# check that a number can be gzipped
-my $number = 7603 ;
-my $num_len = 4 ;
-
-ok $fil = gzopen($name, "wb") ;
-
-is $gzerrno, 0;
-
-is $fil->gzwrite($number), $num_len, "gzwrite returned $num_len" ;
-is $gzerrno, 0, 'gzerrno is 0';
-ok ! $fil->gzflush(Z_FINISH) ;
-
-is $gzerrno, 0, 'gzerrno is 0';
-
-ok ! $fil->gzclose ;
-
-cmp_ok $gzerrno, '==', 0;
-
-ok $fil = gzopen($name, "rb") ;
-
-ok (($x = $fil->gzread($uncomp)) == $num_len) ;
-
-ok $fil->gzerror() == 0 || $fil->gzerror() == Z_STREAM_END;
-ok $gzerrno == 0 || $gzerrno == Z_STREAM_END;
-ok $fil->gzeof() ;
-
-ok ! $fil->gzclose ;
-ok $fil->gzeof() ;
-
-ok $gzerrno == 0
- or print "# gzerrno is $gzerrno\n" ;
-
-1 while unlink $name ;
-
-ok $number == $uncomp ;
-ok $number eq $uncomp ;
-
-
-# now a bigger gzip test
-
-my $text = 'text' ;
-my $file = "$text.gz" ;
-
-ok my $f = gzopen($file, "wb") ;
-
-# generate a long random string
-my $contents = '' ;
-foreach (1 .. 5000)
- { $contents .= chr int rand 256 }
-
-$len = length $contents ;
-
-ok $f->gzwrite($contents) == $len ;
-
-ok ! $f->gzclose ;
-
-ok $f = gzopen($file, "rb") ;
-
-ok ! $f->gzeof() ;
-
-my $uncompressed ;
-is $f->gzread($uncompressed, $len), $len ;
-
-ok $contents eq $uncompressed
-
- or print "# Length orig $len" .
- ", Length uncompressed " . length($uncompressed) . "\n" ;
-
-ok $f->gzeof() ;
-ok ! $f->gzclose ;
+ my $len = length $hello ;
+
+ my ($x, $uncomp) ;
+
+ ok my $fil = gzopen($name, "wb") ;
+
+ is $gzerrno, 0, 'gzerrno is 0';
+ is $fil->gzerror(), 0, "gzerror() returned 0";
+
+ is $fil->gztell(), 0, "gztell returned 0";
+ is $gzerrno, 0, 'gzerrno is 0';
+
+ is $fil->gzwrite($hello), $len ;
+ is $gzerrno, 0, 'gzerrno is 0';
+
+ is $fil->gztell(), $len, "gztell returned $len";
+ is $gzerrno, 0, 'gzerrno is 0';
+
+ ok ! $fil->gzclose ;
+
+ ok $fil = gzopen($name, "rb") ;
+
+ ok ! $fil->gzeof() ;
+ is $gzerrno, 0, 'gzerrno is 0';
+ is $fil->gztell(), 0;
+
+ is $fil->gzread($uncomp), $len;
+
+ is $fil->gztell(), $len;
+ ok $fil->gzeof() ;
+
+ # gzread after eof bahavior
+
+ my $xyz = "123" ;
+ is $fil->gzread($xyz), 0, "gzread returns 0 on eof" ;
+ is $xyz, "", "gzread on eof zaps the output buffer [Match 1,x behavior]" ;
+
+ ok ! $fil->gzclose ;
+ ok $fil->gzeof() ;
+
+ ok $hello eq $uncomp ;
+}
-1 while unlink($file) ;
+{
+ title 'check that a number can be gzipped';
+ my $lex = new LexFile my $name ;
+
+
+ my $number = 7603 ;
+ my $num_len = 4 ;
+
+ ok my $fil = gzopen($name, "wb") ;
+
+ is $gzerrno, 0;
+
+ is $fil->gzwrite($number), $num_len, "gzwrite returned $num_len" ;
+ is $gzerrno, 0, 'gzerrno is 0';
+ ok ! $fil->gzflush(Z_FINISH) ;
+
+ is $gzerrno, 0, 'gzerrno is 0';
+
+ ok ! $fil->gzclose ;
+
+ cmp_ok $gzerrno, '==', 0;
+
+ ok $fil = gzopen($name, "rb") ;
+
+ my $uncomp;
+ ok ((my $x = $fil->gzread($uncomp)) == $num_len) ;
+
+ ok $fil->gzerror() == 0 || $fil->gzerror() == Z_STREAM_END;
+ ok $gzerrno == 0 || $gzerrno == Z_STREAM_END;
+ ok $fil->gzeof() ;
+
+ ok ! $fil->gzclose ;
+ ok $fil->gzeof() ;
+
+ ok $gzerrno == 0
+ or print "# gzerrno is $gzerrno\n" ;
+
+ 1 while unlink $name ;
+
+ ok $number == $uncomp ;
+ ok $number eq $uncomp ;
+}
-# gzip - readline tests
-# ======================
+{
+ title "now a bigger gzip test";
+
+ my $text = 'text' ;
+ my $lex = new LexFile my $file ;
+
+
+ ok my $f = gzopen($file, "wb") ;
+
+ # generate a long random string
+ my $contents = '' ;
+ foreach (1 .. 5000)
+ { $contents .= chr int rand 256 }
+
+ my $len = length $contents ;
+
+ is $f->gzwrite($contents), $len ;
+
+ ok ! $f->gzclose ;
+
+ ok $f = gzopen($file, "rb") ;
+
+ ok ! $f->gzeof() ;
+
+ my $uncompressed ;
+ is $f->gzread($uncompressed, $len), $len ;
+
+ is $contents, $uncompressed
+
+ or print "# Length orig $len" .
+ ", Length uncompressed " . length($uncompressed) . "\n" ;
+
+ ok $f->gzeof() ;
+ ok ! $f->gzclose ;
+
+}
-# first create a small gzipped text file
-$name = "test.gz" ;
-my @text = (<<EOM, <<EOM, <<EOM, <<EOM) ;
+{
+ title "gzip - readline tests";
+ # ======================
+
+ # first create a small gzipped text file
+ my $lex = new LexFile my $name ;
+
+ my @text = (<<EOM, <<EOM, <<EOM, <<EOM) ;
this is line 1
EOM
the second line
EOM
the final line
EOM
-
-$text = join("", @text) ;
-
-ok $fil = gzopen($name, "wb") ;
-ok $fil->gzwrite($text) == length $text ;
-ok ! $fil->gzclose ;
-
-# now try to read it back in
-ok $fil = gzopen($name, "rb") ;
-ok ! $fil->gzeof() ;
-my $line = '';
-for my $i (0 .. @text -2)
-{
- ok $fil->gzreadline($line) > 0;
- is $line, $text[$i] ;
+
+ my $text = join("", @text) ;
+
+ ok my $fil = gzopen($name, "wb") ;
+ is $fil->gzwrite($text), length($text) ;
+ ok ! $fil->gzclose ;
+
+ # now try to read it back in
+ ok $fil = gzopen($name, "rb") ;
ok ! $fil->gzeof() ;
+ my $line = '';
+ for my $i (0 .. @text -2)
+ {
+ ok $fil->gzreadline($line) > 0;
+ is $line, $text[$i] ;
+ ok ! $fil->gzeof() ;
+ }
+
+ # now read the last line
+ ok $fil->gzreadline($line) > 0;
+ is $line, $text[-1] ;
+ ok $fil->gzeof() ;
+
+ # read past the eof
+ is $fil->gzreadline($line), 0;
+
+ ok $fil->gzeof() ;
+ ok ! $fil->gzclose ;
+ ok $fil->gzeof() ;
}
-# now read the last line
-ok $fil->gzreadline($line) > 0;
-is $line, $text[-1] ;
-ok $fil->gzeof() ;
-
-# read past the eof
-is $fil->gzreadline($line), 0;
-
-ok $fil->gzeof() ;
-ok ! $fil->gzclose ;
-ok $fil->gzeof() ;
-1 while unlink($name) ;
-
-# a text file with a very long line (bigger than the internal buffer)
-my $line1 = ("abcdefghijklmnopq" x 2000) . "\n" ;
-my $line2 = "second line\n" ;
-$text = $line1 . $line2 ;
-ok $fil = gzopen($name, "wb") ;
-ok $fil->gzwrite($text) == length $text ;
-ok ! $fil->gzclose ;
-
-# now try to read it back in
-ok $fil = gzopen($name, "rb") ;
-ok ! $fil->gzeof() ;
-my $i = 0 ;
-my @got = ();
-while ($fil->gzreadline($line) > 0) {
- $got[$i] = $line ;
- ++ $i ;
-}
-is $i, 2 ;
-is $got[0], $line1 ;
-is $got[1], $line2 ;
-
-ok $fil->gzeof() ;
-ok ! $fil->gzclose ;
-ok $fil->gzeof() ;
-
-1 while unlink $name ;
-
-# a text file which is not termined by an EOL
-
-$line1 = "hello hello, I'm back again\n" ;
-$line2 = "there is no end in sight" ;
-
-$text = $line1 . $line2 ;
-ok $fil = gzopen($name, "wb") ;
-ok $fil->gzwrite($text) == length $text ;
-ok ! $fil->gzclose ;
+{
+ title "A text file with a very long line (bigger than the internal buffer)";
+ my $lex = new LexFile my $name ;
-# now try to read it back in
-ok $fil = gzopen($name, "rb") ;
-@got = () ; $i = 0 ;
-while ($fil->gzreadline($line) > 0) {
- $got[$i] = $line ;
- ++ $i ;
+ my $line1 = ("abcdefghijklmnopq" x 2000) . "\n" ;
+ my $line2 = "second line\n" ;
+ my $text = $line1 . $line2 ;
+ ok my $fil = gzopen($name, "wb"), " gzopen ok" ;
+ is $fil->gzwrite($text), length $text, " gzwrite ok" ;
+ ok ! $fil->gzclose, " gzclose" ;
+
+ # now try to read it back in
+ ok $fil = gzopen($name, "rb"), " gzopen" ;
+ ok ! $fil->gzeof(), "! eof" ;
+ my $i = 0 ;
+ my @got = ();
+ my $line;
+ while ($fil->gzreadline($line) > 0) {
+ $got[$i] = $line ;
+ ++ $i ;
+ }
+ is $i, 2, " looped twice" ;
+ is $got[0], $line1, " got line 1" ;
+ is $got[1], $line2, " hot line 2" ;
+
+ ok $fil->gzeof(), " gzeof" ;
+ ok ! $fil->gzclose, " gzclose" ;
+ ok $fil->gzeof(), " gzeof" ;
}
-is $i, 2 ;
-is $got[0], $line1 ;
-is $got[1], $line2 ;
-
-ok $fil->gzeof() ;
-ok ! $fil->gzclose ;
-1 while unlink $name ;
+{
+ title "a text file which is not termined by an EOL";
+
+ my $lex = new LexFile my $name ;
+
+ my $line1 = "hello hello, I'm back again\n" ;
+ my $line2 = "there is no end in sight" ;
+
+ my $text = $line1 . $line2 ;
+ ok my $fil = gzopen($name, "wb"), " gzopen" ;
+ is $fil->gzwrite($text), length $text, " gzwrite" ;
+ ok ! $fil->gzclose, " gzclose" ;
+
+ # now try to read it back in
+ ok $fil = gzopen($name, "rb"), " gzopen" ;
+ my @got = () ;
+ my $i = 0 ;
+ my $line;
+ while ($fil->gzreadline($line) > 0) {
+ $got[$i] = $line ;
+ ++ $i ;
+ }
+ is $i, 2, " got 2 lines" ;
+ is $got[0], $line1, " line 1 ok" ;
+ is $got[1], $line2, " line 2 ok" ;
+
+ ok $fil->gzeof(), " gzeof" ;
+ ok ! $fil->gzclose, " gzclose" ;
+}
{
# smaller than the internal block used by
# gzreadline
my $lex = new LexFile my $name ;
- $line1 = "hello hello, I'm back again\n" ;
- $line2 = "abc" x 200 ;
+ my $line1 = "hello hello, I'm back again\n" ;
+ my $line2 = "abc" x 200 ;
my $line3 = "def" x 200 ;
+ my $line;
- $text = $line1 . $line2 . $line3 ;
+ my $text = $line1 . $line2 . $line3 ;
my $fil;
ok $fil = gzopen($name, "wb"), ' gzopen for write ok' ;
is $fil->gzwrite($text), length $text, ' gzwrite ok' ;
$f = new IO::File "<$name" ;
ok $fil = gzopen($name, "rb") ;
- my $uncmomp;
+ my $uncomp; my $x;
ok (($x = $fil->gzread($uncomp)) == $len)
or print "# length $x, expected $len\n" ;
open F, "<$name" ;
ok $fil = gzopen(*F, "rb") ;
- my $uncmomp;
+ my $uncomp; my $x;
$x = $fil->gzread($uncomp);
is $x, $len ;
ok $fil = gzopen($stdin, "rb") ;
- my $uncmomp;
+ my $uncomp; my $x;
ok (($x = $fil->gzread($uncomp)) == $len)
or print "# length $x, expected $len\n" ;
title 'write operations when opened for reading';
my $lex = new LexFile my $name ;
- my $test = "hello" ;
+ my $text = "hello" ;
my $fil;
ok $fil = gzopen($name, "wb"), " gzopen for writing" ;
is $fil->gzwrite($text), length $text, " gzwrite ok" ;
ok ! -r $name, " input file not readable";
$gzerrno = 0;
- $fil = gzopen($name, "rb") ;
+ my $fil = gzopen($name, "rb") ;
ok !$fil, " gzopen returns undef" ;
ok $gzerrno, " gzerrno ok";
chmod 0777, $name ;
--- /dev/null
+BEGIN {
+ if ($ENV{PERL_CORE}) {
+ chdir 't' if -d 't';
+ @INC = ("../lib", "lib/compress");
+ }
+}
+
+use lib qw(t t/compress);
+use Test::More;
+
+eval "use Test::Pod 1.00";
+
+plan skip_all => "Test::Pod 1.00 required for testing POD" if $@;
+
+all_pod_files_ok();
+
+++ /dev/null
-CHANGES
--------
-
- 2.015 3 September 2008
-
- * Makefile.PL
- Backout changes made in 2.014
-
- 2.014 2 September 2008
-
- * Makefile.PL
- Updated to check for indirect dependencies.
-
- 2.013 18 July 2008
-
- * IO::Compress::Base
- - Allow IO::Compress::Base::Parameters::parse to accept an IO::Compress::Base::Parameters object.
-
- 2.012 15 July 2008
-
- * IO::Compress::Base
- - Silenced an uninitialised value warning when reading a line
- at a time from a zip file where the content uses ZIP_CM_STORE.
- [Problem spotted & fixed by Jeff Holt]
-
- * IO::Compress::Base & IO::Uncompress::Base
- - local-ise $!, $? et al in the DESTROY methods.
-
- 2.011 17 May 2008
-
- * IO::Compress::Base
- - Fixed problem that prevented the creation of a zip file that
- contained more than one compression method.
-
- * IO::Compress::Base::Common
- - The private Validator class in this module clashes with another
- CPAN module. Moved Validator into the IO::Compress::Base::Common
- namespace.
- [RT #35954]
-
- 2.010 5 May 2008
-
- * Fixed problem that meant Perl 5.10 could not upgrade this module.
- [RT #35342]
-
- 2.009 20 April 2008
-
- * Removed the alpha status from File::GlobMapper
-
- * IO::Compress::Base
- When writing output never output a zero length buffer.
- Done to improve interoperability with other tied filenandle
- modules.
-
- * Changed IO::Uncompress::Base to not use the offset parameter of
- the read method when reading from a filehandle.
-
- The object returned from Net::FTP::retr implements a non-standard
- read method. The third parameter is used for a timeout value
- rather than an offset.
- [rt.cpan#33231]
-
- * Changed IO::Uncompress::Base to not use the eof method when
- reading from a filehandle.
-
- The object returned from Net::FTP::retr implements both the read
- method and the eof method. Unfortunately the implementation of
- the read method uses non-buffered IO (by using sysread) while
- the eof method uses buffered IO. Mixing buffered and non-buffered
- IO results in data corruption.
-
- 2.008 2 November 2007
-
- * Minor documentation changes in README
-
- 2.006 1 September 20007
-
- * Makefile.PL
- Added INSTALLDIRS directive to install as a core module when built
- on a perl >= 5.9.
-
- 2.005 18 June 2007
-
- * Stephen Turner reported a problem when using IO::Uncompress::Gunzip
- with XML::Parser. Turns out there were two issues.
-
- Firstly an IO::Uncompress object isn't an IO::Handle. It is now.
-
- Secondly the implementation of "read" wasn't honouring this
-
- SCALAR will be grown or shrunk to the length actually read.
-
- In particular it didn't do the right thing on EOF.
- This has been fixed.
-
- 2.004 3 March 2007
-
- * Made seek less wasteful of memory.
-
- 2.003 2 January 2007
-
- * Added explicit version checking
-
- 2.002 29 December 2006
-
- * Documentation updates.
-
- * Added IO::Handle to the ISA test in isaFilehandle
-
- * Add an explicit use_ok test for Scalar::Util in the test harness.
- The error message reported by 01misc implied the problem was
- somewhere else.
- Also explictly check that 'dualvar' is available.
-
- 2.001 1 November 2006
-
- * Remove beta status.
-
- 2.000_14 26 October 2006
-
- * IO::Uncompress::Base
- Added support for $/ in record mode
-
- * IO::Uncompress::Base
- The readline interface was substantially slower than the 1.x
- equivalent. This has now been sorted.
- Thanks to Andreas J. Koenig for spotting the problem.
-
- * IO::Uncompress::AnyUncompress
- Added IO::Uncompress::Lzf to the list of supported uncompresors.
-
- * IO::Uncompress::Base
- Added TrailingData to one-shot interface.
-
- * IO::Uncompress::AnyUncompress
- Remove raw-deflate (RFC1951) from the default list of compressors
- to check.
- It can still be included if the new RawInflate parameter is
- supplied.
- This change was made because the only way to tell if content is
- raw-deflate is to attempt to uncompress it - a few false positives
- have popped up recently, which suggests that auto-detecting raw
- deflate is far from perfect.
- The equivalent change has been made to IO::Uncompress::AnyInflate.
- [Core patch #28445]
-
- * Don't check that filehandles are writable. It would seem that
- "-w *STDOUT" on windows returns false.
- [Core Patch #28415]
-
- 2.000_13 20 June 2006
-
- * Store compress & uncompressed sizes as 64-bit.
-
- * For one-shot uncompression, like this
-
- unzip "some.zip" => \@a, MultiStream => 1;
-
- Push each uncompressed stream from "some.zip" onto @a.
-
- * Added IO::Compress::Base::FilterEnvelope
-
- * Added IO::Uncompress::Base::nextStream
-
- * The '-' filehandle now maps to either *STDIN or *STDOUT.
- This keeps mod_perl happier. Was using these before
-
- new IO::File("<-")
- new IO::File(">-")
-
- 2.000_12 3 May 2006
-
- 2.000_11 10 April 2006
-
- * Transparent + InputLength made more robust where input data is not
- compressed.
-
- 2.000_10 13 March 2006
-
- * AnyUncompress doesn't assume that IO-Compress-Zlib is installed any
- more.
-
- 2.000_09 3 March 2006
-
- * Released to CPAN.
-
- 2.000_08 2 March 2006
-
- * Split IO::Compress::Base into its own distribution.
-
- * Added opened, autoflush and input_line_number.
-
- * Beefed up support for $.
-
+++ /dev/null
-
-=head1 NAME
-
-IO::Compress::Base::FAQ -- Frequently Asked Questions about IO::Compress::Base
-
-=head1 DESCRIPTION
-
-Common questions answered.
-
-=head2 Compatibility with Unix compress/uncompress.
-
-This module is not compatible with Unix C<compress>.
-
-If you have the C<uncompress> program available, you can use this to read
-compressed files
-
- open F, "uncompress -c $filename |";
- while (<F>)
- {
- ...
-
-Alternatively, if you have the C<gunzip> program available, you can use
-this to read compressed files
-
- open F, "gunzip -c $filename |";
- while (<F>)
- {
- ...
-
-and this to write compress files, if you have the C<compress> program
-available
-
- open F, "| compress -c $filename ";
- print F "data";
- ...
- close F ;
-
-=head2 Accessing .tar.Z files
-
-See previous FAQ item.
-
-If the C<Archive::Tar> module is installed and either the C<uncompress> or
-C<gunzip> programs are available, you can use one of these workarounds to
-read C<.tar.Z> files.
-
-Firstly with C<uncompress>
-
- use strict;
- use warnings;
- use Archive::Tar;
-
- open F, "uncompress -c $filename |";
- my $tar = Archive::Tar->new(*F);
- ...
-
-and this with C<gunzip>
-
- use strict;
- use warnings;
- use Archive::Tar;
-
- open F, "gunzip -c $filename |";
- my $tar = Archive::Tar->new(*F);
- ...
-
-Similarly, if the C<compress> program is available, you can use this to
-write a C<.tar.Z> file
-
- use strict;
- use warnings;
- use Archive::Tar;
- use IO::File;
-
- my $fh = new IO::File "| compress -c >$filename";
- my $tar = Archive::Tar->new();
- ...
- $tar->write($fh);
- $fh->close ;
-
-=head2 Accessing Zip Files
-
-This module does not support reading/writing zip files.
-
-Support for reading/writing zip files is included with the
-C<IO::Compress::Zip> and C<IO::Uncompress::Unzip> modules.
-
-The primary focus of the C<IO::Compress::Zip> and C<IO::Uncompress::Unzip>
-modules is to provide an C<IO::File> compatible streaming read/write
-interface to zip files/buffers. They are not fully flegged archivers. If
-you are looking for an archiver check out the C<Archive::Zip> module. You
-can find it on CPAN at
-
- http://www.cpan.org/modules/by-module/Archive/Archive-Zip-*.tar.gz
-
-=head2 Compressed files and Net::FTP
-
-The C<Net::FTP> module provides two low-level methods called C<stor> and
-C<retr> that both return filehandles. These filehandles can used with the
-C<IO::Compress/Uncompress> modules to compress or uncompress files read
-from or written to an FTP Server on the fly, without having to create a
-temporary file.
-
-Firstly, here is code that uses C<retr> to uncompressed a file as it is
-read from the FTP Server.
-
- use Net::FTP;
- use IO::Uncompress::Bunzip2 qw(:all);
-
- my $ftp = new Net::FTP ...
-
- my $retr_fh = $ftp->retr($compressed_filename);
- bunzip2 $retr_fh => $outFilename, AutoClose => 1
- or die "Cannot uncompress '$compressed_file': $Bunzip2Error\n";
-
-and this to compress a file as it is written to the FTP Server
-
- use Net::FTP;
- use IO::Compress::Bzip2 qw(:all);
-
- my $stor_fh = $ftp->stor($filename);
- bzip2 "filename" => $stor_fh, AutoClose => 1
- or die "Cannot compress '$filename': $Bzip2Error\n";
-
-=head2 How do I recompress using a different compression?
-
-This is easier that you might expect if you realise that all the
-C<IO::Compress::*> objects are derived from C<IO::File> and that all the
-C<IO::Uncompress::*> modules can read from an C<IO::File> filehandle.
-
-So, for example, say you have a file compressed with gzip that you want to
-recompress with bzip2. Here is all that is needed to carry out the
-recompression.
-
- use IO::Uncompress::Gunzip ':all';
- use IO::Compress::Bzip2 ':all';
-
- my $gzipFile = "somefile.gz";
- my $bzipFile = "somefile.bz2";
-
- my $gunzip = new IO::Uncompress::Gunzip $gzipFile
- or die "Cannot gunzip $gzipFile: $GunzipError\n" ;
-
- bzip2 $gunzip => $bzipFile
- or die "Cannot bzip2 to $bzipFile: $Bzip2Error\n" ;
-
-Note, there is a limitation of this technique. Some compression file
-formats store extra information along with the compressed data payload. For
-example, gzip can optionally store the original filename and Zip stores a
-lot of information about the original file. If the original compressed file
-contains any of this extra information, it will not be transferred to the
-new compressed file usign the technique above.
-
-=head2 Using C<InputLength> to uncompress data embedded in a larger file/buffer.
-
-A fairly common use-case is where compressed data is embedded in a larger
-file/buffer and you want to read both.
-
-As an example consider the structure of a zip file. This is a well-defined
-file format that mixes both compressed and uncompressed sections of data in
-a single file.
-
-For the purposes of this discussion you can think of a zip file as sequence
-of compressed data streams, each of which is prefixed by an uncompressed
-local header. The local header contains information about the compressed
-data stream, including the name of the compressed file and, in particular,
-the length of the compressed data stream.
-
-To illustrate how to use C<InputLength> here is a script that walks a zip
-file and prints out how many lines are in each compressed file (if you
-intend write code to walking through a zip file for real see
-L<IO::Uncompress::Unzip/"Walking through a zip file"> )
-
- use strict;
- use warnings;
-
- use IO::File;
- use IO::Uncompress::RawInflate qw(:all);
-
- use constant ZIP_LOCAL_HDR_SIG => 0x04034b50;
- use constant ZIP_LOCAL_HDR_LENGTH => 30;
-
- my $file = $ARGV[0] ;
-
- my $fh = new IO::File "<$file"
- or die "Cannot open '$file': $!\n";
-
- while (1)
- {
- my $sig;
- my $buffer;
-
- my $x ;
- ($x = $fh->read($buffer, ZIP_LOCAL_HDR_LENGTH)) == ZIP_LOCAL_HDR_LENGTH
- or die "Truncated file: $!\n";
-
- my $signature = unpack ("V", substr($buffer, 0, 4));
-
- last unless $signature == ZIP_LOCAL_HDR_SIG;
-
- # Read Local Header
- my $gpFlag = unpack ("v", substr($buffer, 6, 2));
- my $compressedMethod = unpack ("v", substr($buffer, 8, 2));
- my $compressedLength = unpack ("V", substr($buffer, 18, 4));
- my $uncompressedLength = unpack ("V", substr($buffer, 22, 4));
- my $filename_length = unpack ("v", substr($buffer, 26, 2));
- my $extra_length = unpack ("v", substr($buffer, 28, 2));
-
- my $filename ;
- $fh->read($filename, $filename_length) == $filename_length
- or die "Truncated file\n";
-
- $fh->read($buffer, $extra_length) == $extra_length
- or die "Truncated file\n";
-
- if ($compressedMethod != 8 && $compressedMethod != 0)
- {
- warn "Skipping file '$filename' - not deflated $compressedMethod\n";
- $fh->read($buffer, $compressedLength) == $compressedLength
- or die "Truncated file\n";
- next;
- }
-
- if ($compressedMethod == 0 && $gpFlag & 8 == 8)
- {
- die "Streamed Stored not supported for '$filename'\n";
- }
-
- next if $compressedLength == 0;
-
- # Done reading the Local Header
-
- my $inf = new IO::Uncompress::RawInflate $fh,
- Transparent => 1,
- InputLength => $compressedLength
- or die "Cannot uncompress $file [$filename]: $RawInflateError\n" ;
-
- my $line_count = 0;
-
- while (<$inf>)
- {
- ++ $line_count;
- }
-
- print "$filename: $line_count\n";
- }
-
-The majority of the code above is concerned with reading the zip local
-header data. The code that I want to focus on is at the bottom.
-
- while (1) {
-
- # read local zip header data
- # get $filename
- # get $compressedLength
-
- my $inf = new IO::Uncompress::RawInflate $fh,
- Transparent => 1,
- InputLength => $compressedLength
- or die "Cannot uncompress $file [$filename]: $RawInflateError\n" ;
-
- my $line_count = 0;
-
- while (<$inf>)
- {
- ++ $line_count;
- }
-
- print "$filename: $line_count\n";
- }
-
-The call to C<IO::Uncompress::RawInflate> creates a new filehandle C<$inf>
-that can be used to read from the parent filehandle C<$fh>, uncompressing
-it as it goes. The use of the C<InputLength> option will guarantee that
-I<at most> C<$compressedLength> bytes of compressed data will be read from
-the C<$fh> filehandle (The only exception is for an error case like a
-truncated file or a corrupt data stream).
-
-This means that once RawInflate is finished C<$fh> will be left at the
-byte directly after the compressed data stream.
-
-Now consider what the code looks like without C<InputLength>
-
- while (1) {
-
- # read local zip header data
- # get $filename
- # get $compressedLength
-
- # read all the compressed data into $data
- read($fh, $data, $compressedLength);
-
- my $inf = new IO::Uncompress::RawInflate \$data,
- Transparent => 1,
- or die "Cannot uncompress $file [$filename]: $RawInflateError\n" ;
-
- my $line_count = 0;
-
- while (<$inf>)
- {
- ++ $line_count;
- }
-
- print "$filename: $line_count\n";
- }
-
-The difference here is the addition of the temporary variable C<$data>.
-This is used to store a copy of the compressed data while it is being
-uncompressed.
-
-If you know that C<$compressedLength> isn't that big then using temporary
-storage won't be a problem. But if C<$compressedLength> is very large or
-you are writing an application that other people will use, and so have no
-idea how big C<$compressedLength> will be, it could be an issue.
-
-Using C<InputLength> avoids the use of temporary storage and means the
-application can cope with large compressed data streams.
-
-One final point -- obviously C<InputLength> can only be used whenever you
-know the length of the compressed data beforehand, like here with a zip
-file.
-
-=head1 SEE ALSO
-
-L<Compress::Zlib>, L<IO::Compress::Gzip>, L<IO::Uncompress::Gunzip>, L<IO::Compress::Deflate>, L<IO::Uncompress::Inflate>, L<IO::Compress::RawDeflate>, L<IO::Uncompress::RawInflate>, L<IO::Compress::Bzip2>, L<IO::Uncompress::Bunzip2>, L<IO::Compress::Lzop>, L<IO::Uncompress::UnLzop>, L<IO::Compress::Lzf>, L<IO::Uncompress::UnLzf>, L<IO::Uncompress::AnyInflate>, L<IO::Uncompress::AnyUncompress>
-
-L<Compress::Zlib::FAQ|Compress::Zlib::FAQ>
-
-L<File::GlobMapper|File::GlobMapper>, L<Archive::Zip|Archive::Zip>,
-L<Archive::Tar|Archive::Tar>,
-L<IO::Zlib|IO::Zlib>
-
-=head1 AUTHOR
-
-This module was written by Paul Marquess, F<pmqs@cpan.org>.
-
-=head1 MODIFICATION HISTORY
-
-See the Changes file.
-
-=head1 COPYRIGHT AND LICENSE
-
-Copyright (c) 2005-2008 Paul Marquess. All rights reserved.
-
-This program is free software; you can redistribute it and/or
-modify it under the same terms as Perl itself.
-
+++ /dev/null
-package MakeUtil ;
-package main ;
-
-use strict ;
-
-use Config qw(%Config);
-use File::Copy;
-
-my $VERSION = '1.0';
-
-
-BEGIN
-{
- eval { require File::Spec::Functions ; File::Spec::Functions->import() } ;
- if ($@)
- {
- *catfile = sub { return "$_[0]/$_[1]" }
- }
-}
-
-require VMS::Filespec if $^O eq 'VMS';
-
-
-unless($ENV{PERL_CORE}) {
- $ENV{PERL_CORE} = 1 if grep { $_ eq 'PERL_CORE=1' } @ARGV;
-}
-
-$ENV{SKIP_FOR_CORE} = 1 if $ENV{PERL_CORE} || $ENV{MY_PERL_CORE} ;
-
-
-
-sub MY::libscan
-{
- my $self = shift;
- my $path = shift;
-
- return undef
- if $path =~ /(~|\.bak|_bak)$/ ||
- $path =~ /\..*\.sw(o|p)$/ ||
- $path =~ /\B\.svn\b/;
-
- return $path;
-}
-
-sub MY::postamble
-{
- return ''
- if $ENV{PERL_CORE} ;
-
- my @files = getPerlFiles('MANIFEST');
-
- # Note: Once you remove all the layers of shell/makefile escaping
- # the regular expression below reads
- #
- # /^\s*local\s*\(\s*\$^W\s*\)/
- #
- my $postamble = '
-
-MyTrebleCheck:
- @echo Checking for $$^W in files: '. "@files" . '
- @perl -ne \' \
- exit 1 if /^\s*local\s*\(\s*\$$\^W\s*\)/; \
- \' ' . " @files || " . ' \
- (echo found unexpected $$^W ; exit 1)
- @echo All is ok.
-
-';
-
- return $postamble;
-}
-
-sub getPerlFiles
-{
- my @manifests = @_ ;
-
- my @files = ();
-
- for my $manifest (@manifests)
- {
- my $prefix = './';
-
- $prefix = $1
- if $manifest =~ m#^(.*/)#;
-
- open M, "<$manifest"
- or die "Cannot open '$manifest': $!\n";
- while (<M>)
- {
- chomp ;
- next if /^\s*#/ || /^\s*$/ ;
-
- s/^\s+//;
- s/\s+$//;
-
- /^(\S+)\s*(.*)$/;
-
- my ($file, $rest) = ($1, $2);
-
- if ($file =~ /\.(pm|pl|t)$/ and $file !~ /MakeUtil.pm/)
- {
- push @files, "$prefix$file";
- }
- elsif ($rest =~ /perl/i)
- {
- push @files, "$prefix$file";
- }
-
- }
- close M;
- }
-
- return @files;
-}
-
-sub UpDowngrade
-{
- return if defined $ENV{TipTop};
-
- my @files = @_ ;
-
- # our and use bytes/utf8 is stable from 5.6.0 onward
- # warnings is stable from 5.6.1 onward
-
- # Note: this code assumes that each statement it modifies is not
- # split across multiple lines.
-
-
- my $warn_sub = '';
- my $our_sub = '' ;
-
- my $upgrade ;
- my $downgrade ;
- my $do_downgrade ;
-
- my $caller = (caller(1))[3] || '';
-
- if ($caller =~ /downgrade/)
- {
- $downgrade = 1;
- }
- elsif ($caller =~ /upgrade/)
- {
- $upgrade = 1;
- }
- else
- {
- $do_downgrade = 1
- if $] < 5.006001 ;
- }
-
-# else
-# {
-# my $opt = shift @ARGV || '' ;
-# $upgrade = ($opt =~ /^-upgrade/i);
-# $downgrade = ($opt =~ /^-downgrade/i);
-# push @ARGV, $opt unless $downgrade || $upgrade;
-# }
-
-
- if ($downgrade || $do_downgrade) {
- # From: use|no warnings "blah"
- # To: local ($^W) = 1; # use|no warnings "blah"
- $warn_sub = sub {
- s/^(\s*)(no\s+warnings)/${1}local (\$^W) = 0; #$2/ ;
- s/^(\s*)(use\s+warnings)/${1}local (\$^W) = 1; #$2/ ;
- };
- }
- #elsif ($] >= 5.006001 || $upgrade) {
- elsif ($upgrade) {
- # From: local ($^W) = 1; # use|no warnings "blah"
- # To: use|no warnings "blah"
- $warn_sub = sub {
- s/^(\s*)local\s*\(\$\^W\)\s*=\s*\d+\s*;\s*#\s*((no|use)\s+warnings.*)/$1$2/ ;
- };
- }
-
- if ($downgrade || $do_downgrade) {
- $our_sub = sub {
- if ( /^(\s*)our\s+\(\s*([^)]+\s*)\)/ ) {
- my $indent = $1;
- my $vars = join ' ', split /\s*,\s*/, $2;
- $_ = "${indent}use vars qw($vars);\n";
- }
- elsif ( /^(\s*)((use|no)\s+(bytes|utf8)\s*;.*)$/)
- {
- $_ = "$1# $2\n";
- }
- };
- }
- #elsif ($] >= 5.006000 || $upgrade) {
- elsif ($upgrade) {
- $our_sub = sub {
- if ( /^(\s*)use\s+vars\s+qw\((.*?)\)/ ) {
- my $indent = $1;
- my $vars = join ', ', split ' ', $2;
- $_ = "${indent}our ($vars);\n";
- }
- elsif ( /^(\s*)#\s*((use|no)\s+(bytes|utf8)\s*;.*)$/)
- {
- $_ = "$1$2\n";
- }
- };
- }
-
- if (! $our_sub && ! $warn_sub) {
- warn "Up/Downgrade not needed.\n";
- if ($upgrade || $downgrade)
- { exit 0 }
- else
- { return }
- }
-
- foreach (@files) {
- #if (-l $_ )
- { doUpDown($our_sub, $warn_sub, $_) }
- #else
- #{ doUpDownViaCopy($our_sub, $warn_sub, $_) }
- }
-
- warn "Up/Downgrade complete.\n" ;
- exit 0 if $upgrade || $downgrade;
-
-}
-
-
-sub doUpDown
-{
- my $our_sub = shift;
- my $warn_sub = shift;
-
- return if -d $_[0];
-
- local ($^I) = ($^O eq 'VMS') ? "_bak" : ".bak";
- local (@ARGV) = shift;
-
- while (<>)
- {
- print, last if /^__(END|DATA)__/ ;
-
- &{ $our_sub }() if $our_sub ;
- &{ $warn_sub }() if $warn_sub ;
- print ;
- }
-
- return if eof ;
-
- while (<>)
- { print }
-}
-
-sub doUpDownViaCopy
-{
- my $our_sub = shift;
- my $warn_sub = shift;
- my $file = shift ;
-
- use File::Copy ;
-
- return if -d $file ;
-
- my $backup = $file . ($^O eq 'VMS') ? "_bak" : ".bak";
-
- copy($file, $backup)
- or die "Cannot copy $file to $backup: $!";
-
- my @keep = ();
-
- {
- open F, "<$file"
- or die "Cannot open $file: $!\n" ;
- while (<F>)
- {
- if (/^__(END|DATA)__/)
- {
- push @keep, $_;
- last ;
- }
-
- &{ $our_sub }() if $our_sub ;
- &{ $warn_sub }() if $warn_sub ;
- push @keep, $_;
- }
-
- if (! eof F)
- {
- while (<F>)
- { push @keep, $_ }
- }
- close F;
- }
-
- {
- open F, ">$file"
- or die "Cannot open $file: $!\n";
- print F @keep ;
- close F;
- }
-}
-
-
-sub FindBrokenDependencies
-{
- my $version = shift ;
- my %thisModule = map { $_ => 1} @_;
-
- my @modules = qw(
- IO::Compress::Base
- IO::Compress::Base::Common
- IO::Uncompress::Base
-
- Compress::Raw::Zlib
- Compress::Raw::Bzip2
-
- IO::Compress::RawDeflate
- IO::Uncompress::RawInflate
- IO::Compress::Deflate
- IO::Uncompress::Inflate
- IO::Compress::Gzip
- IO::Compress::Gzip::Constants
- IO::Uncompress::Gunzip
- IO::Compress::Zip
- IO::Uncompress::Unzip
-
- IO::Compress::Bzip2
- IO::Uncompress::Bunzip2
-
- IO::Compress::Lzf
- IO::Uncompress::UnLzf
-
- IO::Compress::Lzop
- IO::Uncompress::UnLzop
-
- Compress::Zlib
- );
-
- my @broken = ();
-
- foreach my $module ( grep { ! $thisModule{$_} } @modules)
- {
- my $hasVersion = getInstalledVersion($module);
-
- # No need to upgrade if the module isn't installed at all
- next
- if ! defined $hasVersion;
-
- # If already have C::Z version 1, then an upgrade to any of the
- # IO::Compress modules will not break it.
- next
- if $module eq 'Compress::Zlib' && $hasVersion < 2;
-
- if ($hasVersion < $version)
- {
- push @broken, $module
- }
- }
-
- return @broken;
-}
-
-sub getInstalledVersion
-{
- my $module = shift;
- my $version;
-
- eval " require $module; ";
-
- if ($@ eq '')
- {
- no strict 'refs';
- $version = ${ $module . "::VERSION" };
- $version = 0
- }
-
- return $version;
-}
-
-package MakeUtil ;
-
-1;
-
-
+++ /dev/null
-CHANGES
--------
-
- 2.015 3 September 2008
-
- * Makefile.PL
- Backout changes made in 2.014
-
- 2.014 2 September 2008
-
- * Makefile.PL
- Updated to check for indirect dependencies.
-
- 2.012 15 July 2008
-
- * No Changes
-
- 2.011 17 May 2008
-
- * IO::Uncompress::Unzip
- - Print an error message if the zip file contains a
- member compressed with bzip2 and IO::Uncompress::Bunzip2 is
- not available.
- - Could not cope with mixed compression zip files. For example a
- zip file that contains both STORED and DEFLATED content.
- [RT #35573]
-
- 2.010 5 May 2008
-
- * Fixed problem that meant Perl 5.10 could not upgrade this module.
- [RT #35343]
-
- 2.009 20 April 2008
-
- * IO::Compress::Zip
-
- - Added exUnix2 option to allow storing of UID & GID.
- - When running on a Unix derivative the ExtAttr option now defaults
- to the equivalent of 0666. For all other systems the default
- remains 0.
-
- 2.008 2 November 2007
-
- * Minor documentation changes in README
-
- * t/compress/truncate.pl
- EBCDIC Cleanup.
-
- * IO::Compress::Gzip::Constants.pm
- Tidied up the character classes used to defined invalid
- FNAME & FCOMMENT fields for EBCDIC.
-
- 2.006 1 September 2007
-
- * Makefile.PL
- Added INSTALLDIRS directive to install as a core module when built
- on a perl >= 5.9.
-
- * IO::Uncompress::RawDeflate
-
- - Fixed export problem - "$RawDeflateError" and "rawdeflate" were
- not being exported with ":all".
-
- 2.005 18 June 2007
-
- * IO::Compress::Gzip & IO::Uncompress::Gunzip
-
- - RFC1952 says that the FNAME & FCOMMENT header fields must be ISO
- 8859-1 (LATIN-1) characters. The code can optionally police this.
- Added a fix for this logic when running on EBCDIC.
-
- * Makefile.PL
-
- - Check if IO::Compress::Bzip2 is already installed. If it is, add
- to the PREREQ_PM list.
-
- 2.004 3 March 2007
-
- * IO::Compress::Zip
-
- - Added Zip64 documentation.
-
- - Fixed extended timestamp.
- Creation time isn't available in Unix so only store the
- modification time and the last access time in the extended field.
-
- - Fixed file mode.
-
- - Added ExtAttr option to control the value of the "external file
- attributes" field in the central directory.
-
- - Added Unix2 extended attribute ("Ux").
- This stores the UID & GID.
-
- * IO::Compress::Gzip
-
- - Fixed 050interop-gzip.t for Windows
-
- 2.003 2 January 2007
-
- * Added explicit version checking
-
- 2.002 29 December 2006
-
- * Documentation updates.
-
- 2.001 1 November 2006
-
- * Remove beta status.
-
- 2.000_14 26 October 2006
-
- * IO::Uncompress::Deflate
- Beefed up the magic signature check. Means less false positives
- when auto-detecting the compression type.
-
- * IO::Uncompress::UnZip
- Tighten up the zip64 extra field processing to cope with the case
- wheere only some of the local header fields are superceeded.
-
- * IO::Uncompress::AnyInflate
- Remove raw-deflate (RFC 1951) from the default list of compressors
- to check.
- It can still be included if the new RawInflate parameter is
- supplied.
- This change was made because the only way to tell if content is
- raw-deflate is to attempt to uncompress it - a few false positives
- have popped up recently, which suggests that auto-detecting raw
- deflate is far from perfect.
- The equivalent change has been made to IO::Uncompress::AnyUncompress.
- [Core patch #28445]
-
- 2.000_13 20 June 2006
-
- * Preliminary support for reading zip files with zip64 members.
-
- 2.000_12 3 May 2006
-
- * Moved the code for creating and parsing the gzip extra field into
- IO::Compress::Zlib::Extra.pm so that IO::Compress::Zip &
- IO::Uncompress::Unzip can use it as well.
-
- * Added ExtraFieldLocal & ExtraFieldCentral options to IO::Compress::Zip.
- These allow the creation of user-defined extra fields in the local
- and central headers, just like the ExtraField option in
- IO::Compress::Gzip.
-
- * Moved the zip constants into IO::Compress::Zip::Constants
-
- * Added exTime option to IO::Compress::Zip.
- This allows creation of the extended timestamp extra field.
-
- * Added Minimal option to IO::Compress::Zip.
- This disables the creation of all extended fields.
-
- * Added TextFlag option to IO::Compress::Zip.
-
- * Documented Comment and ZipComment options in IO::Compress::Zip.
-
- 2.000_11 10 April 2006
-
- * Updated Documentation for zip modules.
-
- * Changed IO::Compress::Zip 'Store' option to 'Method' and added
- symbolic constants ZIP_CM_STORE, ZIP_CM_DEFLATE and ZIP_CM_BZIP2 to
- allow the compression method to be picked by the user.
-
- * Added support to allow bzip2 compressed data to be written/read
- with IO::Compress::Zip and IO::Uncompress::Unzip.
-
- * Beefed up 050interop-gzip.t to check that the external gzip command
- works as expected before starting the tests. This means that
- this test harness will just be skipped on problematic systems.
-
- * Merged core patch 27565 from Steve Peters. This works around a
- problem with gzip on OpenBSD where it doesn't seem to like
- compressing files < 10 bytes long.
-
- 2.000_10 13 March 2006
-
- * Documentation updates.
-
- 2.000_09 3 March 2006
-
- * Released to CPAN.
-
- 2.000_08 2 March 2006
-
- * Split IO::Compress::Zlib into its own distribution.
-
- * Beefed up support for zip/unzip
-
-
-
+++ /dev/null
-#! perl -w
-
-use strict ;
-require 5.004 ;
-
-$::VERSION = '2.015' ;
-
-use private::MakeUtil;
-use ExtUtils::MakeMaker 5.16 ;
-
-UpDowngrade(getPerlFiles('MANIFEST'))
- unless $ENV{PERL_CORE};
-
-my @MainPREREQ = qw(Compress::Raw::Zlib
- IO::Compress::Base
- IO::Uncompress::Base
- );
-
-# Bzip2 is an option prereq.
-push @MainPREREQ, qw(IO::Compress::Bzip2 IO::Uncompress::Bunzip2)
- if eval { require IO::Compress::Bzip2; };
-
-my %MainPREREQ = map { $_ => $::VERSION } @MainPREREQ;
-
-
-WriteMakefile(
- NAME => 'IO::Compress::Zlib',
- VERSION_FROM => 'lib/IO/Compress/Gzip.pm',
- 'dist' => { COMPRESS => 'gzip',
- TARFLAGS => '-chvf',
- SUFFIX => 'gz',
- DIST_DEFAULT => 'MyTrebleCheck tardist',
- },
-
- (
- $ENV{SKIP_FOR_CORE}
- ? (MAN3PODS => {})
- : (PREREQ_PM => { %MainPREREQ,
- $] >= 5.005 && $] < 5.006
- ? ('File::BSDGlob' => 0)
- : () }
- )
- ),
-
- (
- $] >= 5.005
- ? (ABSTRACT => 'Perl interface to zlib',
- AUTHOR => 'Paul Marquess <pmqs@cpan.org>')
- : ()
- ),
-
- INSTALLDIRS => ($] >= 5.009 ? 'perl' : 'site'),
-
- (
- $] >= 5.009 && ! $ENV{PERL_CORE}
- ? (INST_LIB => 'blib/arch')
- : ()
- ),
-
-
- ((ExtUtils::MakeMaker->VERSION() gt '6.30') ?
- ('LICENSE' => 'perl') : ()),
-
-) ;
-
-# end of file Makefile.PL
-
+++ /dev/null
-
- IO-Compress-Zlib
-
- Version 2.015
-
- 2nd September 2008
-
- Copyright (c) 2005-2008 Paul Marquess. All rights reserved.
- This program is free software; you can redistribute it
- and/or modify it under the same terms as Perl itself.
-
-DESCRIPTION
------------
-
-This module provides a Perl interface to allow reading and writing of RFC
-1950, 1951, 1952 (i.e. gzip) and zip files/buffers.
-
-PREREQUISITES
--------------
-
-Before you can build IO-Compress-Zlib you need to have the following
-installed on your system:
-
- * Perl 5.004 or better.
- * Compress::Raw::Zlib
- * IO::Compress::Base
-
-BUILDING THE MODULE
--------------------
-
-Assuming you have met all the prerequisites, the module can now be built
-using this sequence of commands:
-
- perl Makefile.PL
- make
- make test
-
-INSTALLATION
-------------
-
-To install IO-Compress-Zlib, run the command below:
-
- make install
-
-TROUBLESHOOTING
----------------
-
-The t/020isize Test Suite
-------------------------
-
-This test suite checks that IO-Compress-Zlib can cope with gzip files
-that are larger than 2^32 bytes.
-
-By default these tests are NOT run when you do a "make test". If you
-really want to run them, you need to execute "make longtest".
-
-Be warned though -- this test suite can take hours to run on a slow box.
-
-Also, due to the way the tests are constructed, some architectures will
-run out of memory during this test. This should not be considered a bug
-in the IO-Compress-Zlib module.
-
-FEEDBACK
---------
-
-How to report a problem with IO-Compress-Zlib.
-
-To help me help you, I need all of the following information:
-
- 1. The Versions of everything relevant.
- This includes:
-
- a. The *complete* output from running this
-
- perl -V
-
- Do not edit the output in any way.
- Note, I want you to run "perl -V" and NOT "perl -v".
-
- If your perl does not understand the "-V" option it is too
- old. This module needs Perl version 5.004 or better.
-
- b. The version of IO-Compress-Zlib you have.
- If you have successfully installed IO-Compress-Zlib, this one-liner
- will tell you:
-
- perl -MIO::Compress::Gzip -e 'print qq[ver $IO::Compress::Gzip::VERSION\n]'
-
- If you are running windows use this
-
- perl -MIO::Compress::Gzip -e "print qq[ver $IO::Compress::Gzip::VERSION\n]"
-
- If you haven't installed IO-Compress-Zlib then search IO::Compress::Gzip.pm
- for a line like this:
-
- $VERSION = "2.015" ;
-
- 2. If you are having problems building IO-Compress-Zlib, send me a
- complete log of what happened. Start by unpacking the IO-Compress-Zlib
- module into a fresh directory and keep a log of all the steps
-
- [edit config.in, if necessary]
- perl Makefile.PL
- make
- make test TEST_VERBOSE=1
-
-Paul Marquess <pmqs@cpan.org>
+++ /dev/null
-
-use strict;
-use warnings;
-
-use File::Path;
-use File::Basename;
-use IO::File;
-use IO::Uncompress::RawInflate qw(:all);
-
-
-die "Usage: zipcat file\n"
- if @ARGV != 1 ;
-
-my $file = $ARGV[0] ;
-
-my $fh = new IO::File "<$file"
- or die "Cannot open '$file': $!\n";
-
-while ()
-{
- my $FIXED_HEADER_LENGTH = 30 ;
- my $sig;
- my $buffer;
-
- my $x ;
- ($x = $fh->read($buffer, $FIXED_HEADER_LENGTH)) == $FIXED_HEADER_LENGTH
- or die "Truncated file top: $x $!\n";
-
- my $signature = unpack ("V", substr($buffer, 0, 4));
-
- last unless $signature == 0x04034b50;
-
- my $compressedMethod = unpack ("v", substr($buffer, 8, 2));
- my $compressedLength = unpack ("V", substr($buffer, 18, 4));
- #my $uncompressedLength = unpack ("V", substr($buffer, 22, 4));
- my $filename_length = unpack ("v", substr($buffer, 26, 2));
- my $extra_length = unpack ("v", substr($buffer, 28, 2));
-
- warn "Compressed Length $compressedLength\n";
- my $filename ;
- $fh->read($filename, $filename_length) == $filename_length
- or die "Truncated file\n";
-
- $fh->read($buffer, $extra_length) == $extra_length
- or die "Truncated file\n";
-
- if ($compressedMethod != 8 && $compressedMethod != 0)
- {
- warn "Skipping file '$filename' - not deflated $compressedMethod\n";
- $fh->read($buffer, $compressedLength) == $compressedLength
- or die "Truncated file\n";
- next;
- }
-
- next if $compressedLength == 0;
-
- warn "Writing file '$filename' $compressedMethod\n";
-
- #mkpath dirname $filename;
-
- #rawinflate $fh => $filename,
- rawinflate $fh => '-',
- Transparent => 1,
- InputLength => $compressedLength
- or die "Error uncompressing $file [$filename]: $RawInflateError\n" ;
-}
-
-sub decodeLocalFileHeader
-{
- my $buffer = shift ;
-}
-
-
+++ /dev/null
-package MakeUtil ;
-package main ;
-
-use strict ;
-
-use Config qw(%Config);
-use File::Copy;
-
-my $VERSION = '1.0';
-
-
-BEGIN
-{
- eval { require File::Spec::Functions ; File::Spec::Functions->import() } ;
- if ($@)
- {
- *catfile = sub { return "$_[0]/$_[1]" }
- }
-}
-
-require VMS::Filespec if $^O eq 'VMS';
-
-
-unless($ENV{PERL_CORE}) {
- $ENV{PERL_CORE} = 1 if grep { $_ eq 'PERL_CORE=1' } @ARGV;
-}
-
-$ENV{SKIP_FOR_CORE} = 1 if $ENV{PERL_CORE} || $ENV{MY_PERL_CORE} ;
-
-
-
-sub MY::libscan
-{
- my $self = shift;
- my $path = shift;
-
- return undef
- if $path =~ /(~|\.bak|_bak)$/ ||
- $path =~ /\..*\.sw(o|p)$/ ||
- $path =~ /\B\.svn\b/;
-
- return $path;
-}
-
-sub MY::postamble
-{
- return ''
- if $ENV{PERL_CORE} ;
-
- my @files = getPerlFiles('MANIFEST');
-
- # Note: Once you remove all the layers of shell/makefile escaping
- # the regular expression below reads
- #
- # /^\s*local\s*\(\s*\$^W\s*\)/
- #
- my $postamble = '
-
-MyTrebleCheck:
- @echo Checking for $$^W in files: '. "@files" . '
- @perl -ne \' \
- exit 1 if /^\s*local\s*\(\s*\$$\^W\s*\)/; \
- \' ' . " @files || " . ' \
- (echo found unexpected $$^W ; exit 1)
- @echo All is ok.
-
-';
-
- return $postamble;
-}
-
-sub getPerlFiles
-{
- my @manifests = @_ ;
-
- my @files = ();
-
- for my $manifest (@manifests)
- {
- my $prefix = './';
-
- $prefix = $1
- if $manifest =~ m#^(.*/)#;
-
- open M, "<$manifest"
- or die "Cannot open '$manifest': $!\n";
- while (<M>)
- {
- chomp ;
- next if /^\s*#/ || /^\s*$/ ;
-
- s/^\s+//;
- s/\s+$//;
-
- /^(\S+)\s*(.*)$/;
-
- my ($file, $rest) = ($1, $2);
-
- if ($file =~ /\.(pm|pl|t)$/ and $file !~ /MakeUtil.pm/)
- {
- push @files, "$prefix$file";
- }
- elsif ($rest =~ /perl/i)
- {
- push @files, "$prefix$file";
- }
-
- }
- close M;
- }
-
- return @files;
-}
-
-sub UpDowngrade
-{
- return if defined $ENV{TipTop};
-
- my @files = @_ ;
-
- # our and use bytes/utf8 is stable from 5.6.0 onward
- # warnings is stable from 5.6.1 onward
-
- # Note: this code assumes that each statement it modifies is not
- # split across multiple lines.
-
-
- my $warn_sub = '';
- my $our_sub = '' ;
-
- my $upgrade ;
- my $downgrade ;
- my $do_downgrade ;
-
- my $caller = (caller(1))[3] || '';
-
- if ($caller =~ /downgrade/)
- {
- $downgrade = 1;
- }
- elsif ($caller =~ /upgrade/)
- {
- $upgrade = 1;
- }
- else
- {
- $do_downgrade = 1
- if $] < 5.006001 ;
- }
-
-# else
-# {
-# my $opt = shift @ARGV || '' ;
-# $upgrade = ($opt =~ /^-upgrade/i);
-# $downgrade = ($opt =~ /^-downgrade/i);
-# push @ARGV, $opt unless $downgrade || $upgrade;
-# }
-
-
- if ($downgrade || $do_downgrade) {
- # From: use|no warnings "blah"
- # To: local ($^W) = 1; # use|no warnings "blah"
- $warn_sub = sub {
- s/^(\s*)(no\s+warnings)/${1}local (\$^W) = 0; #$2/ ;
- s/^(\s*)(use\s+warnings)/${1}local (\$^W) = 1; #$2/ ;
- };
- }
- #elsif ($] >= 5.006001 || $upgrade) {
- elsif ($upgrade) {
- # From: local ($^W) = 1; # use|no warnings "blah"
- # To: use|no warnings "blah"
- $warn_sub = sub {
- s/^(\s*)local\s*\(\$\^W\)\s*=\s*\d+\s*;\s*#\s*((no|use)\s+warnings.*)/$1$2/ ;
- };
- }
-
- if ($downgrade || $do_downgrade) {
- $our_sub = sub {
- if ( /^(\s*)our\s+\(\s*([^)]+\s*)\)/ ) {
- my $indent = $1;
- my $vars = join ' ', split /\s*,\s*/, $2;
- $_ = "${indent}use vars qw($vars);\n";
- }
- elsif ( /^(\s*)((use|no)\s+(bytes|utf8)\s*;.*)$/)
- {
- $_ = "$1# $2\n";
- }
- };
- }
- #elsif ($] >= 5.006000 || $upgrade) {
- elsif ($upgrade) {
- $our_sub = sub {
- if ( /^(\s*)use\s+vars\s+qw\((.*?)\)/ ) {
- my $indent = $1;
- my $vars = join ', ', split ' ', $2;
- $_ = "${indent}our ($vars);\n";
- }
- elsif ( /^(\s*)#\s*((use|no)\s+(bytes|utf8)\s*;.*)$/)
- {
- $_ = "$1$2\n";
- }
- };
- }
-
- if (! $our_sub && ! $warn_sub) {
- warn "Up/Downgrade not needed.\n";
- if ($upgrade || $downgrade)
- { exit 0 }
- else
- { return }
- }
-
- foreach (@files) {
- #if (-l $_ )
- { doUpDown($our_sub, $warn_sub, $_) }
- #else
- #{ doUpDownViaCopy($our_sub, $warn_sub, $_) }
- }
-
- warn "Up/Downgrade complete.\n" ;
- exit 0 if $upgrade || $downgrade;
-
-}
-
-
-sub doUpDown
-{
- my $our_sub = shift;
- my $warn_sub = shift;
-
- return if -d $_[0];
-
- local ($^I) = ($^O eq 'VMS') ? "_bak" : ".bak";
- local (@ARGV) = shift;
-
- while (<>)
- {
- print, last if /^__(END|DATA)__/ ;
-
- &{ $our_sub }() if $our_sub ;
- &{ $warn_sub }() if $warn_sub ;
- print ;
- }
-
- return if eof ;
-
- while (<>)
- { print }
-}
-
-sub doUpDownViaCopy
-{
- my $our_sub = shift;
- my $warn_sub = shift;
- my $file = shift ;
-
- use File::Copy ;
-
- return if -d $file ;
-
- my $backup = $file . ($^O eq 'VMS') ? "_bak" : ".bak";
-
- copy($file, $backup)
- or die "Cannot copy $file to $backup: $!";
-
- my @keep = ();
-
- {
- open F, "<$file"
- or die "Cannot open $file: $!\n" ;
- while (<F>)
- {
- if (/^__(END|DATA)__/)
- {
- push @keep, $_;
- last ;
- }
-
- &{ $our_sub }() if $our_sub ;
- &{ $warn_sub }() if $warn_sub ;
- push @keep, $_;
- }
-
- if (! eof F)
- {
- while (<F>)
- { push @keep, $_ }
- }
- close F;
- }
-
- {
- open F, ">$file"
- or die "Cannot open $file: $!\n";
- print F @keep ;
- close F;
- }
-}
-
-
-sub FindBrokenDependencies
-{
- my $version = shift ;
- my %thisModule = map { $_ => 1} @_;
-
- my @modules = qw(
- IO::Compress::Base
- IO::Compress::Base::Common
- IO::Uncompress::Base
-
- Compress::Raw::Zlib
- Compress::Raw::Bzip2
-
- IO::Compress::RawDeflate
- IO::Uncompress::RawInflate
- IO::Compress::Deflate
- IO::Uncompress::Inflate
- IO::Compress::Gzip
- IO::Compress::Gzip::Constants
- IO::Uncompress::Gunzip
- IO::Compress::Zip
- IO::Uncompress::Unzip
-
- IO::Compress::Bzip2
- IO::Uncompress::Bunzip2
-
- IO::Compress::Lzf
- IO::Uncompress::UnLzf
-
- IO::Compress::Lzop
- IO::Uncompress::UnLzop
-
- Compress::Zlib
- );
-
- my @broken = ();
-
- foreach my $module ( grep { ! $thisModule{$_} } @modules)
- {
- my $hasVersion = getInstalledVersion($module);
-
- # No need to upgrade if the module isn't installed at all
- next
- if ! defined $hasVersion;
-
- # If already have C::Z version 1, then an upgrade to any of the
- # IO::Compress modules will not break it.
- next
- if $module eq 'Compress::Zlib' && $hasVersion < 2;
-
- if ($hasVersion < $version)
- {
- push @broken, $module
- }
- }
-
- return @broken;
-}
-
-sub getInstalledVersion
-{
- my $module = shift;
- my $version;
-
- eval " require $module; ";
-
- if ($@ eq '')
- {
- no strict 'refs';
- $version = ${ $module . "::VERSION" };
- $version = 0
- }
-
- return $version;
-}
-
-package MakeUtil ;
-
-1;
-
-
$extra = 1
if $st ;
- plan(tests => 670 + $extra) ;
+ plan(tests => 675 + $extra) ;
}
sub myGZreadFile
my($out, $gz);
$out = "" ;
- eval qq[\$a = new $CompressClass ] . '$out ;' ;
- like $@, mkEvalErr("^$CompressClass: output filename is undef or null string");
+ $a = new $CompressClass $out ;
+ is $!, "No such file or directory", '$! = "no such file or directory"';
+ is $$Error, "cannot open file '': No such file or directory";
$out = undef ;
- eval qq[\$a = new $CompressClass \$out ;] ;
- like $@, mkEvalErr("^$CompressClass: output filename is undef or null string");
+ $a = new $CompressClass $out ;
+ is $!, "No such file or directory", '$! = "no such file or directory"';
+ is $$Error, "cannot open file '': No such file or directory";
my $x ;
$gz = new $CompressClass(\$x);
title "Testing $UncompressClass Errors";
my $out = "" ;
- eval qq[\$a = new $UncompressClass \$out ;] ;
- like $@, mkEvalErr("^$UncompressClass: input filename is undef or null string");
+ $a = new $UncompressClass $out ;
+ is $!, "No such file or directory", '$! = "no such file or directory"';
+ is $$UnError, "cannot open file '': No such file or directory";
+
$out = undef ;
- eval qq[\$a = new $UncompressClass \$out ;] ;
- like $@, mkEvalErr("^$UncompressClass: input filename is undef or null string");
+ $a = new $UncompressClass $out ;
+ is $!, "No such file or directory", '$! = "no such file or directory"';
+ is $$UnError, "cannot open file '': No such file or directory";
my $lex = new LexFile my $name ;
ok ! -e $name, " $name does not exist";
eval qq[\$a = new $UncompressClass "$name" ;] ;
- is $$UnError, "input file '$name' does not exist";
+ is $!, "No such file or directory", '$! = "no such file or directory"';
+ is $$UnError, "cannot open file '$name': No such file or directory";
my $gc ;
my $guz = new $CompressClass(\$gc);
{
if ($to_file) {
- is $$Error, "Output file '$out_file' is not writable",
+ like $$Error, "/Permission denied/",
" Got non-writable filename message" ;
}
else {
ok ! $CompressClass->new($buffer, Merge => 1), " constructor fails";
{
- like $$Error, '/Cannot create InflateScan object: (Header Error|unexpected end of file)/', " got Bad Magic" ;
+ like $$Error, '/Cannot create InflateScan object: (Header Error|unexpected end of file|Inflation Error: data error)/', " got Bad Magic" ;
}
}
$extra = 1
if eval { require Test::NoWarnings ; import Test::NoWarnings; 1 };
- plan tests => 694 + $extra ;
+ plan tests => 1324 + $extra ;
use_ok('IO::Uncompress::AnyUncompress', qw($AnyUncompressError)) ;
even more stuff
EOM
+ my $b0length = length $buffers[0];
+ my $bufcount = @buffers;
+
{
my $cc ;
my $gz ;
}
foreach my $unc ($UncompressClass, 'IO::Uncompress::AnyUncompress') {
+ foreach my $blk (1, 20, $b0length - 1, $b0length, $b0length +1) {
+ title " Testing $CompressClass with $unc, BlockSize $blk and $i streams, from $fb";
+ $cc = $output ;
+ if ($fb eq 'filehandle')
+ {
+ $cc = new IO::File "<$name" ;
+ }
+ my @opts = $unc ne $UncompressClass
+ ? (RawInflate => 1)
+ : ();
+ my $gz = new $unc($cc,
+ @opts,
+ Strict => 1,
+ AutoClose => 1,
+ Append => 1,
+ MultiStream => 1,
+ Transparent => 0)
+ or diag $$UnError;
+ isa_ok $gz, $UncompressClass, ' $gz' ;
+
+ my $un = '';
+ my $b = $blk;
+ # Want the first read to be in the middle of a stream
+ # and the second to cross a stream boundary
+ $b = 1000 while $gz->read($un, $b) > 0 ;
+ #print "[[$un]]\n" while $gz->read($un) > 0 ;
+ ok ! $gz->error(), " ! error()"
+ or diag "Error is " . $gz->error() ;
+ ok $gz->eof(), " eof()";
+ ok $gz->close(), " close() ok"
+ or diag "errno $!\n" ;
+
+ is $gz->streamCount(), $i +1, " streamCount ok " . ($i +1)
+ or diag "Stream count is " . $gz->streamCount();
+ ok $un eq join('', @buffs), " expected output" ;
+
+ }
+ }
+
+ foreach my $unc ($UncompressClass, 'IO::Uncompress::AnyUncompress') {
title " Testing $CompressClass with $unc nextStream and $i streams, from $fb";
$cc = $output ;
if ($fb eq 'filehandle')
is $gz->tell(), 0, " tell is 0";
}
- is $gz->nextStream(), 0, " nextStream ok";
+ is $gz->nextStream(), 0, " nextStream ok"
+ or diag $gz->error() ;
ok $gz->eof(), " eof()";
ok $gz->close(), " close() ok"
or diag "errno $!\n" ;
$extra = 1
if eval { require Test::NoWarnings ; import Test::NoWarnings; 1 };
- plan tests => 970 + $extra ;
+ plan tests => 986 + $extra ;
use_ok('IO::Uncompress::AnyUncompress', qw(anyuncompress $AnyUncompressError)) ;
my $Func = getTopFuncRef($bit);
my $TopType = getTopFuncName($bit);
+ #my $inverse = getInverse($bit);
+ #my $InverseFunc = getTopFuncRef($inverse);
+
title "Testing $TopType Error Cases";
my $a;
my $TopTypeInverse = getInverse($bit);
my $FuncInverse = getTopFuncRef($TopTypeInverse);
+ my $ErrorInverse = getErrorRef($TopTypeInverse);
my $lex = new LexFile(my $file1, my $file2) ;
my @headers = getHeaders($file3);
is @headers, $ms ? @input : 1, " Header count ok";
}
+
+ SKIP:
+ {
+ title "Truncated file";
+ skip '', 7
+ if $CompressClass =~ /lzop|lzf/i ;
+
+ my @in ;
+ push @in, "abcde" x 10;
+ push @in, "defgh" x 1000;
+ push @in, "12345" x 50000;
+
+ my $out;
+
+ for (@in) {
+ ok &$Func(\$_ , \$out, Append => 1 ), ' Compressed ok'
+ or diag $$Error;
+ }
+ #ok &$Func(\@in, \$out, MultiStream => 1 ), ' Compressed ok'
+ substr($out, -179) = '';
+
+ my $got;
+ my $status ;
+ ok $status = &$FuncInverse(\$out => \$got, MultiStream => 0), " Uncompressed stream 1 ok";
+ is $got, "abcde" x 10 ;
+ ok ! &$FuncInverse(\$out => \$got, MultiStream => 1), " Didn't uncompress";
+ is $$ErrorInverse, "unexpected end of file", " Got unexpected eof";
+ }
}
}