summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorPaul Marquess <pmqs@cpan.org>2009-03-14 00:45:02 +0000
committerRafael Garcia-Suarez <rgarciasuarez@gmail.com>2009-03-15 00:00:56 +0100
commit319fab5061bb39ddf68cef7d70abb160bf5f03e3 (patch)
treeb72b99c2ed9afca5a7de15b64ff0e1c2fbb36e8b
parentf50fa36f2a6ffc958fea8e2e5430b2a3d7a9bcf2 (diff)
downloadperl-319fab5061bb39ddf68cef7d70abb160bf5f03e3.tar.gz
Create IO-Compress
-rw-r--r--MANIFEST271
-rw-r--r--ext/Compress-Raw-Bzip2/Changes2
-rw-r--r--ext/Compress-Raw-Bzip2/README8
-rw-r--r--ext/Compress-Raw-Bzip2/lib/Compress/Raw/Bzip2.pm10
-rw-r--r--ext/Compress-Raw-Bzip2/pod/FAQ.pod2
-rw-r--r--ext/Compress-Raw-Bzip2/t/000prereq.t2
-rw-r--r--ext/Compress-Raw-Zlib/Changes10
-rw-r--r--ext/Compress-Raw-Zlib/README39
-rw-r--r--ext/Compress-Raw-Zlib/Zlib.xs56
-rw-r--r--ext/Compress-Raw-Zlib/lib/Compress/Raw/Zlib.pm226
-rw-r--r--ext/Compress-Raw-Zlib/pod/FAQ.pod2
-rw-r--r--ext/Compress-Raw-Zlib/t/02zlib.t19
-rwxr-xr-xext/Compress-Zlib/Makefile.PL81
-rw-r--r--ext/Compress-Zlib/README120
-rw-r--r--ext/Compress-Zlib/pod/FAQ.pod125
-rw-r--r--ext/Compress-Zlib/t/03zlib-v1.t1188
-rw-r--r--ext/IO-Compress/Changes (renamed from ext/Compress-Zlib/Changes)339
-rw-r--r--ext/IO-Compress/MANIFEST151
-rw-r--r--ext/IO-Compress/Makefile.PL (renamed from ext/IO_Compress_Base/Makefile.PL)26
-rw-r--r--ext/IO-Compress/README (renamed from ext/IO_Compress_Base/README)38
-rwxr-xr-xext/IO-Compress/examples/compress-zlib/filtdef (renamed from ext/Compress-Zlib/examples/filtdef)0
-rwxr-xr-xext/IO-Compress/examples/compress-zlib/filtinf (renamed from ext/Compress-Zlib/examples/filtinf)0
-rwxr-xr-xext/IO-Compress/examples/compress-zlib/gzcat (renamed from ext/Compress-Zlib/examples/gzcat)0
-rwxr-xr-xext/IO-Compress/examples/compress-zlib/gzgrep (renamed from ext/Compress-Zlib/examples/gzgrep)0
-rwxr-xr-xext/IO-Compress/examples/compress-zlib/gzstream (renamed from ext/Compress-Zlib/examples/gzstream)0
-rwxr-xr-xext/IO-Compress/examples/io/anycat17
-rwxr-xr-xext/IO-Compress/examples/io/bzip2/bzcat29
-rwxr-xr-xext/IO-Compress/examples/io/bzip2/bzgrep25
-rwxr-xr-xext/IO-Compress/examples/io/bzip2/bzstream9
-rw-r--r--ext/IO-Compress/examples/io/gzip/gzappend (renamed from ext/IO_Compress_Zlib/examples/gzappend)0
-rwxr-xr-xext/IO-Compress/examples/io/gzip/gzcat (renamed from ext/IO_Compress_Zlib/examples/gzcat)0
-rwxr-xr-xext/IO-Compress/examples/io/gzip/gzgrep (renamed from ext/IO_Compress_Zlib/examples/gzgrep)0
-rwxr-xr-xext/IO-Compress/examples/io/gzip/gzstream (renamed from ext/IO_Compress_Zlib/examples/gzstream)0
-rw-r--r--ext/IO-Compress/lib/Compress/Zlib.pm (renamed from ext/Compress-Zlib/lib/Compress/Zlib.pm)23
-rw-r--r--ext/IO-Compress/lib/File/GlobMapper.pm (renamed from ext/IO_Compress_Base/lib/File/GlobMapper.pm)0
-rw-r--r--ext/IO-Compress/lib/IO/Compress/Adapter/Bzip2.pm162
-rw-r--r--ext/IO-Compress/lib/IO/Compress/Adapter/Deflate.pm (renamed from ext/IO_Compress_Zlib/lib/IO/Compress/Adapter/Deflate.pm)6
-rw-r--r--ext/IO-Compress/lib/IO/Compress/Adapter/Identity.pm (renamed from ext/IO_Compress_Zlib/lib/IO/Compress/Adapter/Identity.pm)4
-rw-r--r--ext/IO-Compress/lib/IO/Compress/Base.pm (renamed from ext/IO_Compress_Base/lib/IO/Compress/Base.pm)16
-rw-r--r--ext/IO-Compress/lib/IO/Compress/Base/Common.pm (renamed from ext/IO_Compress_Base/lib/IO/Compress/Base/Common.pm)2
-rw-r--r--ext/IO-Compress/lib/IO/Compress/Bzip2.pm758
-rw-r--r--ext/IO-Compress/lib/IO/Compress/Deflate.pm (renamed from ext/IO_Compress_Zlib/lib/IO/Compress/Deflate.pm)16
-rw-r--r--ext/IO-Compress/lib/IO/Compress/Gzip.pm (renamed from ext/IO_Compress_Zlib/lib/IO/Compress/Gzip.pm)18
-rw-r--r--ext/IO-Compress/lib/IO/Compress/Gzip/Constants.pm (renamed from ext/IO_Compress_Zlib/lib/IO/Compress/Gzip/Constants.pm)2
-rw-r--r--ext/IO-Compress/lib/IO/Compress/RawDeflate.pm (renamed from ext/IO_Compress_Zlib/lib/IO/Compress/RawDeflate.pm)18
-rw-r--r--ext/IO-Compress/lib/IO/Compress/Zip.pm (renamed from ext/IO_Compress_Zlib/lib/IO/Compress/Zip.pm)48
-rw-r--r--ext/IO-Compress/lib/IO/Compress/Zip/Constants.pm (renamed from ext/IO_Compress_Zlib/lib/IO/Compress/Zip/Constants.pm)2
-rw-r--r--ext/IO-Compress/lib/IO/Compress/Zlib/Constants.pm (renamed from ext/IO_Compress_Zlib/lib/IO/Compress/Zlib/Constants.pm)2
-rw-r--r--ext/IO-Compress/lib/IO/Compress/Zlib/Extra.pm (renamed from ext/IO_Compress_Zlib/lib/IO/Compress/Zlib/Extra.pm)4
-rw-r--r--ext/IO-Compress/lib/IO/Uncompress/Adapter/Bunzip2.pm199
-rwxr-xr-x[-rw-r--r--]ext/IO-Compress/lib/IO/Uncompress/Adapter/Identity.pm (renamed from ext/IO_Compress_Zlib/lib/IO/Uncompress/Adapter/Identity.pm)6
-rw-r--r--ext/IO-Compress/lib/IO/Uncompress/Adapter/Inflate.pm (renamed from ext/IO_Compress_Zlib/lib/IO/Uncompress/Adapter/Inflate.pm)20
-rw-r--r--ext/IO-Compress/lib/IO/Uncompress/AnyInflate.pm (renamed from ext/IO_Compress_Zlib/lib/IO/Uncompress/AnyInflate.pm)20
-rw-r--r--ext/IO-Compress/lib/IO/Uncompress/AnyUncompress.pm (renamed from ext/IO_Compress_Base/lib/IO/Uncompress/AnyUncompress.pm)55
-rw-r--r--ext/IO-Compress/lib/IO/Uncompress/Base.pm (renamed from ext/IO_Compress_Base/lib/IO/Uncompress/Base.pm)46
-rw-r--r--ext/IO-Compress/lib/IO/Uncompress/Bunzip2.pm858
-rw-r--r--ext/IO-Compress/lib/IO/Uncompress/Gunzip.pm (renamed from ext/IO_Compress_Zlib/lib/IO/Uncompress/Gunzip.pm)16
-rw-r--r--ext/IO-Compress/lib/IO/Uncompress/Inflate.pm (renamed from ext/IO_Compress_Zlib/lib/IO/Uncompress/Inflate.pm)10
-rwxr-xr-x[-rw-r--r--]ext/IO-Compress/lib/IO/Uncompress/RawInflate.pm (renamed from ext/IO_Compress_Zlib/lib/IO/Uncompress/RawInflate.pm)41
-rw-r--r--ext/IO-Compress/lib/IO/Uncompress/Unzip.pm (renamed from ext/IO_Compress_Zlib/lib/IO/Uncompress/Unzip.pm)71
-rw-r--r--ext/IO-Compress/pod/FAQ.pod (renamed from ext/IO_Compress_Zlib/pod/FAQ.pod)20
-rw-r--r--ext/IO-Compress/private/MakeUtil.pm (renamed from ext/Compress-Zlib/private/MakeUtil.pm)0
-rw-r--r--ext/IO-Compress/t/000prereq.t56
-rw-r--r--ext/IO-Compress/t/001bzip2.t206
-rw-r--r--ext/IO-Compress/t/001zlib-generic-deflate.t (renamed from ext/IO_Compress_Zlib/t/001zlib-generic-deflate.t)0
-rw-r--r--ext/IO-Compress/t/001zlib-generic-gzip.t (renamed from ext/IO_Compress_Zlib/t/001zlib-generic-gzip.t)0
-rw-r--r--ext/IO-Compress/t/001zlib-generic-rawdeflate.t (renamed from ext/IO_Compress_Zlib/t/001zlib-generic-rawdeflate.t)0
-rw-r--r--ext/IO-Compress/t/001zlib-generic-zip.t (renamed from ext/IO_Compress_Zlib/t/001zlib-generic-zip.t)0
-rw-r--r--ext/IO-Compress/t/002any-deflate.t (renamed from ext/IO_Compress_Zlib/t/002any-deflate.t)0
-rw-r--r--ext/IO-Compress/t/002any-gzip.t (renamed from ext/IO_Compress_Zlib/t/002any-gzip.t)0
-rw-r--r--ext/IO-Compress/t/002any-rawdeflate.t (renamed from ext/IO_Compress_Zlib/t/002any-rawdeflate.t)0
-rw-r--r--ext/IO-Compress/t/002any-transparent.t (renamed from ext/IO_Compress_Zlib/t/002any-transparent.t)0
-rw-r--r--ext/IO-Compress/t/002any-zip.t (renamed from ext/IO_Compress_Zlib/t/002any-zip.t)0
-rw-r--r--ext/IO-Compress/t/004gziphdr.t (renamed from ext/IO_Compress_Zlib/t/004gziphdr.t)0
-rw-r--r--ext/IO-Compress/t/005defhdr.t (renamed from ext/IO_Compress_Zlib/t/005defhdr.t)0
-rw-r--r--ext/IO-Compress/t/006zip.t (renamed from ext/IO_Compress_Zlib/t/006zip.t)0
-rw-r--r--ext/IO-Compress/t/010examples-bzip2.t145
-rw-r--r--ext/IO-Compress/t/010examples-zlib.t (renamed from ext/IO_Compress_Zlib/t/010examples.t)4
-rw-r--r--ext/IO-Compress/t/01misc.t (renamed from ext/IO_Compress_Base/t/01misc.t)0
-rw-r--r--ext/IO-Compress/t/020isize.t (renamed from ext/IO_Compress_Zlib/t/020isize.t)0
-rw-r--r--ext/IO-Compress/t/050interop-gzip.t (renamed from ext/IO_Compress_Zlib/t/050interop-gzip.t)0
-rw-r--r--ext/IO-Compress/t/100generic-bzip2.t21
-rw-r--r--ext/IO-Compress/t/100generic-deflate.t (renamed from ext/IO_Compress_Zlib/t/100generic-deflate.t)0
-rw-r--r--ext/IO-Compress/t/100generic-gzip.t (renamed from ext/IO_Compress_Zlib/t/100generic-gzip.t)0
-rw-r--r--ext/IO-Compress/t/100generic-rawdeflate.t (renamed from ext/IO_Compress_Zlib/t/100generic-rawdeflate.t)0
-rw-r--r--ext/IO-Compress/t/100generic-zip.t (renamed from ext/IO_Compress_Zlib/t/100generic-zip.t)0
-rw-r--r--ext/IO-Compress/t/101truncate-bzip2.t37
-rw-r--r--ext/IO-Compress/t/101truncate-deflate.t (renamed from ext/IO_Compress_Zlib/t/101truncate-deflate.t)0
-rw-r--r--ext/IO-Compress/t/101truncate-gzip.t (renamed from ext/IO_Compress_Zlib/t/101truncate-gzip.t)0
-rw-r--r--ext/IO-Compress/t/101truncate-rawdeflate.t (renamed from ext/IO_Compress_Zlib/t/101truncate-rawdeflate.t)6
-rw-r--r--ext/IO-Compress/t/101truncate-zip.t (renamed from ext/IO_Compress_Zlib/t/101truncate-zip.t)0
-rw-r--r--ext/IO-Compress/t/102tied-bzip2.t21
-rw-r--r--ext/IO-Compress/t/102tied-deflate.t (renamed from ext/IO_Compress_Zlib/t/102tied-deflate.t)0
-rw-r--r--ext/IO-Compress/t/102tied-gzip.t (renamed from ext/IO_Compress_Zlib/t/102tied-gzip.t)0
-rw-r--r--ext/IO-Compress/t/102tied-rawdeflate.t (renamed from ext/IO_Compress_Zlib/t/102tied-rawdeflate.t)0
-rw-r--r--ext/IO-Compress/t/102tied-zip.t (renamed from ext/IO_Compress_Zlib/t/102tied-zip.t)0
-rw-r--r--ext/IO-Compress/t/103newtied-bzip2.t21
-rw-r--r--ext/IO-Compress/t/103newtied-deflate.t (renamed from ext/IO_Compress_Zlib/t/103newtied-deflate.t)0
-rw-r--r--ext/IO-Compress/t/103newtied-gzip.t (renamed from ext/IO_Compress_Zlib/t/103newtied-gzip.t)0
-rw-r--r--ext/IO-Compress/t/103newtied-rawdeflate.t (renamed from ext/IO_Compress_Zlib/t/103newtied-rawdeflate.t)0
-rw-r--r--ext/IO-Compress/t/103newtied-zip.t (renamed from ext/IO_Compress_Zlib/t/103newtied-zip.t)0
-rw-r--r--ext/IO-Compress/t/104destroy-bzip2.t21
-rw-r--r--ext/IO-Compress/t/104destroy-deflate.t (renamed from ext/IO_Compress_Zlib/t/104destroy-deflate.t)0
-rw-r--r--ext/IO-Compress/t/104destroy-gzip.t (renamed from ext/IO_Compress_Zlib/t/104destroy-gzip.t)0
-rw-r--r--ext/IO-Compress/t/104destroy-rawdeflate.t (renamed from ext/IO_Compress_Zlib/t/104destroy-rawdeflate.t)0
-rw-r--r--ext/IO-Compress/t/104destroy-zip.t (renamed from ext/IO_Compress_Zlib/t/104destroy-zip.t)0
-rw-r--r--ext/IO-Compress/t/105oneshot-bzip2.t22
-rw-r--r--ext/IO-Compress/t/105oneshot-deflate.t (renamed from ext/IO_Compress_Zlib/t/105oneshot-deflate.t)0
-rw-r--r--ext/IO-Compress/t/105oneshot-gzip-only.t (renamed from ext/IO_Compress_Zlib/t/105oneshot-gzip-only.t)0
-rw-r--r--ext/IO-Compress/t/105oneshot-gzip.t (renamed from ext/IO_Compress_Zlib/t/105oneshot-gzip.t)1
-rw-r--r--ext/IO-Compress/t/105oneshot-rawdeflate.t (renamed from ext/IO_Compress_Zlib/t/105oneshot-rawdeflate.t)0
-rw-r--r--ext/IO-Compress/t/105oneshot-zip-bzip2-only.t168
-rw-r--r--ext/IO-Compress/t/105oneshot-zip-only.t (renamed from ext/IO_Compress_Zlib/t/105oneshot-zip-only.t)0
-rw-r--r--ext/IO-Compress/t/105oneshot-zip.t (renamed from ext/IO_Compress_Zlib/t/105oneshot-zip.t)0
-rw-r--r--ext/IO-Compress/t/106prime-bzip2.t21
-rw-r--r--ext/IO-Compress/t/106prime-deflate.t (renamed from ext/IO_Compress_Zlib/t/106prime-deflate.t)0
-rw-r--r--ext/IO-Compress/t/106prime-gzip.t (renamed from ext/IO_Compress_Zlib/t/106prime-gzip.t)0
-rw-r--r--ext/IO-Compress/t/106prime-rawdeflate.t (renamed from ext/IO_Compress_Zlib/t/106prime-rawdeflate.t)0
-rw-r--r--ext/IO-Compress/t/106prime-zip.t (renamed from ext/IO_Compress_Zlib/t/106prime-zip.t)0
-rw-r--r--ext/IO-Compress/t/107multi-bzip2.t21
-rw-r--r--ext/IO-Compress/t/107multi-deflate.t (renamed from ext/IO_Compress_Zlib/t/107multi-deflate.t)0
-rw-r--r--ext/IO-Compress/t/107multi-gzip.t (renamed from ext/IO_Compress_Zlib/t/107multi-gzip.t)0
-rw-r--r--ext/IO-Compress/t/107multi-rawdeflate.t (renamed from ext/IO_Compress_Zlib/t/107multi-rawdeflate.t)0
-rw-r--r--ext/IO-Compress/t/107multi-zip.t (renamed from ext/IO_Compress_Zlib/t/107multi-zip.t)0
-rw-r--r--ext/IO-Compress/t/108anyunc-bzip2.t29
-rw-r--r--ext/IO-Compress/t/108anyunc-deflate.t (renamed from ext/IO_Compress_Zlib/t/108anyunc-deflate.t)0
-rw-r--r--ext/IO-Compress/t/108anyunc-gzip.t (renamed from ext/IO_Compress_Zlib/t/108anyunc-gzip.t)0
-rw-r--r--ext/IO-Compress/t/108anyunc-rawdeflate.t (renamed from ext/IO_Compress_Zlib/t/108anyunc-rawdeflate.t)0
-rw-r--r--ext/IO-Compress/t/108anyunc-transparent.t (renamed from ext/IO_Compress_Zlib/t/108anyunc-transparent.t)0
-rw-r--r--ext/IO-Compress/t/108anyunc-zip.t (renamed from ext/IO_Compress_Zlib/t/108anyunc-zip.t)0
-rw-r--r--ext/IO-Compress/t/109merge-deflate.t (renamed from ext/IO_Compress_Zlib/t/109merge-deflate.t)0
-rw-r--r--ext/IO-Compress/t/109merge-gzip.t (renamed from ext/IO_Compress_Zlib/t/109merge-gzip.t)0
-rw-r--r--ext/IO-Compress/t/109merge-rawdeflate.t (renamed from ext/IO_Compress_Zlib/t/109merge-rawdeflate.t)0
-rw-r--r--ext/IO-Compress/t/109merge-zip.t (renamed from ext/IO_Compress_Zlib/t/109merge-zip.t)0
-rw-r--r--ext/IO-Compress/t/110encode-bzip2.t21
-rw-r--r--ext/IO-Compress/t/110encode-deflate.t (renamed from ext/IO_Compress_Zlib/t/110encode-deflate.t)0
-rw-r--r--ext/IO-Compress/t/110encode-gzip.t (renamed from ext/IO_Compress_Zlib/t/110encode-gzip.t)0
-rw-r--r--ext/IO-Compress/t/110encode-rawdeflate.t (renamed from ext/IO_Compress_Zlib/t/110encode-rawdeflate.t)0
-rw-r--r--ext/IO-Compress/t/110encode-zip.t (renamed from ext/IO_Compress_Zlib/t/110encode-zip.t)0
-rw-r--r--ext/IO-Compress/t/999pod.t16
-rw-r--r--ext/IO-Compress/t/99pod.t16
-rw-r--r--ext/IO-Compress/t/cz-01version.t (renamed from ext/Compress-Zlib/t/01version.t)0
-rw-r--r--ext/IO-Compress/t/cz-05examples.t (renamed from ext/Compress-Zlib/t/05examples.t)4
-rw-r--r--ext/IO-Compress/t/cz-06gzsetp.t (renamed from ext/Compress-Zlib/t/06gzsetp.t)0
-rw-r--r--ext/IO-Compress/t/cz-08encoding.t (renamed from ext/Compress-Zlib/t/08encoding.t)0
-rw-r--r--ext/IO-Compress/t/cz-14gzopen.t (renamed from ext/Compress-Zlib/t/14gzopen.t)453
-rw-r--r--ext/IO-Compress/t/cz-99pod.t16
-rw-r--r--ext/IO-Compress/t/globmapper.t (renamed from ext/IO_Compress_Base/t/globmapper.t)0
-rw-r--r--ext/IO_Compress_Base/Changes194
-rw-r--r--ext/IO_Compress_Base/pod/FAQ.pod346
-rw-r--r--ext/IO_Compress_Base/private/MakeUtil.pm381
-rw-r--r--ext/IO_Compress_Zlib/Changes194
-rw-r--r--ext/IO_Compress_Zlib/Makefile.PL67
-rw-r--r--ext/IO_Compress_Zlib/README107
-rw-r--r--ext/IO_Compress_Zlib/examples/unzip73
-rw-r--r--ext/IO_Compress_Zlib/private/MakeUtil.pm381
-rw-r--r--t/lib/compress/generic.pl26
-rw-r--r--t/lib/compress/merge.pl4
-rw-r--r--t/lib/compress/multi.pl48
-rw-r--r--t/lib/compress/oneshot.pl34
160 files changed, 4494 insertions, 3925 deletions
diff --git a/MANIFEST b/MANIFEST
index 4ff81a5a55..1427ba45e4 100644
--- a/MANIFEST
+++ b/MANIFEST
@@ -200,23 +200,6 @@ ext/Compress-Raw-Zlib/zlib-src/zlib.h Compress::Raw::Zlib
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
@@ -754,107 +737,6 @@ ext/I18N-Langinfo/Langinfo.xs I18N::Langinfo
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
@@ -889,6 +771,159 @@ ext/IO/t/io_udp.t See if UDP socket-related methods from IO work
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
diff --git a/ext/Compress-Raw-Bzip2/Changes b/ext/Compress-Raw-Bzip2/Changes
index f25e57a017..f5133dbedd 100644
--- a/ext/Compress-Raw-Bzip2/Changes
+++ b/ext/Compress-Raw-Bzip2/Changes
@@ -1,7 +1,7 @@
CHANGES
-------
- 2.016 26 February 2009
+ 2.017 26 February 2009
* Minor changes to allow building in perl core.
diff --git a/ext/Compress-Raw-Bzip2/README b/ext/Compress-Raw-Bzip2/README
index 158b897002..d54c8596aa 100644
--- a/ext/Compress-Raw-Bzip2/README
+++ b/ext/Compress-Raw-Bzip2/README
@@ -1,11 +1,11 @@
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.
@@ -159,7 +159,7 @@ To help me help you, I need all of the following information:
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
diff --git a/ext/Compress-Raw-Bzip2/lib/Compress/Raw/Bzip2.pm b/ext/Compress-Raw-Bzip2/lib/Compress/Raw/Bzip2.pm
index ebc60a05fb..3b4615276b 100644
--- a/ext/Compress-Raw-Bzip2/lib/Compress/Raw/Bzip2.pm
+++ b/ext/Compress-Raw-Bzip2/lib/Compress/Raw/Bzip2.pm
@@ -12,7 +12,7 @@ use Carp ;
use bytes ;
our ($VERSION, $XS_VERSION, @ISA, @EXPORT, $AUTOLOAD);
-$VERSION = '2.015';
+$VERSION = '2.017';
$XS_VERSION = $VERSION;
$VERSION = eval $VERSION;
@@ -275,6 +275,12 @@ If C<appendOutput> is enabled in the constructor for the bunzip2 object,
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
@@ -322,7 +328,7 @@ See the Changes file.
=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.
diff --git a/ext/Compress-Raw-Bzip2/pod/FAQ.pod b/ext/Compress-Raw-Bzip2/pod/FAQ.pod
index f429807958..41921a5d44 100644
--- a/ext/Compress-Raw-Bzip2/pod/FAQ.pod
+++ b/ext/Compress-Raw-Bzip2/pod/FAQ.pod
@@ -112,7 +112,7 @@ See the Changes file.
=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.
diff --git a/ext/Compress-Raw-Bzip2/t/000prereq.t b/ext/Compress-Raw-Bzip2/t/000prereq.t
index 99d249be55..1467eeda7d 100644
--- a/ext/Compress-Raw-Bzip2/t/000prereq.t
+++ b/ext/Compress-Raw-Bzip2/t/000prereq.t
@@ -19,7 +19,7 @@ BEGIN
if eval { require Test::NoWarnings ; import Test::NoWarnings; 1 };
- my $VERSION = '2.015';
+ my $VERSION = '2.016';
my @NAMES = qw(
);
diff --git a/ext/Compress-Raw-Zlib/Changes b/ext/Compress-Raw-Zlib/Changes
index e818e4f2f7..c66156cb5c 100644
--- a/ext/Compress-Raw-Zlib/Changes
+++ b/ext/Compress-Raw-Zlib/Changes
@@ -1,6 +1,16 @@
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
diff --git a/ext/Compress-Raw-Zlib/README b/ext/Compress-Raw-Zlib/README
index 0a5f5182cc..1a35da425f 100644
--- a/ext/Compress-Raw-Zlib/README
+++ b/ext/Compress-Raw-Zlib/README
@@ -1,11 +1,11 @@
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.
@@ -177,6 +177,35 @@ this module.
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"
---------------------------------------------------------------------------
@@ -277,7 +306,7 @@ it ships with a pre-compiled version of Compress-Raw-Zlib. To check if a
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.
@@ -326,7 +355,7 @@ To help me help you, I need all of the following information:
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
diff --git a/ext/Compress-Raw-Zlib/Zlib.xs b/ext/Compress-Raw-Zlib/Zlib.xs
index 821e1d1c7b..9a117f3a41 100644
--- a/ext/Compress-Raw-Zlib/Zlib.xs
+++ b/ext/Compress-Raw-Zlib/Zlib.xs
@@ -3,7 +3,7 @@
* 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.
*
@@ -1272,7 +1272,7 @@ inflate (s, buf, output, eof=FALSE)
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:
@@ -1306,21 +1306,37 @@ inflate (s, buf, output, eof=FALSE)
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 ;
@@ -1330,7 +1346,13 @@ inflate (s, buf, output, eof=FALSE)
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) {
@@ -1338,11 +1360,16 @@ inflate (s, buf, output, eof=FALSE)
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) {
@@ -1376,8 +1403,8 @@ inflate (s, buf, output, eof=FALSE)
#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 ;
@@ -1411,6 +1438,7 @@ inflate (s, buf, output, eof=FALSE)
*SvEND(buf) = '\0';
SvSETMAGIC(buf);
}
+
}
OUTPUT:
RETVAL
diff --git a/ext/Compress-Raw-Zlib/lib/Compress/Raw/Zlib.pm b/ext/Compress-Raw-Zlib/lib/Compress/Raw/Zlib.pm
index 6d096e016d..ee87bfa883 100644
--- a/ext/Compress-Raw-Zlib/lib/Compress/Raw/Zlib.pm
+++ b/ext/Compress-Raw-Zlib/lib/Compress/Raw/Zlib.pm
@@ -13,7 +13,7 @@ use warnings ;
use bytes ;
our ($VERSION, $XS_VERSION, @ISA, @EXPORT, $AUTOLOAD);
-$VERSION = '2.015';
+$VERSION = '2.017';
$XS_VERSION = $VERSION;
$VERSION = eval $VERSION;
@@ -547,6 +547,7 @@ Compress::Raw::Zlib - Low-Level Interface to zlib compression library
($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() ;
@@ -576,8 +577,7 @@ Compress::Raw::Zlib - Low-Level Interface to zlib compression library
$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
@@ -763,6 +763,16 @@ the C<$d> object, the compressed data will be appended to C<$output>. If
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>.
@@ -965,7 +975,7 @@ This option defaults to false.
=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
@@ -973,6 +983,162 @@ follows the compressed stream will be left in the input buffer.
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
@@ -1101,7 +1267,7 @@ Returns the total number of uncompressed bytes output from inflate.
Returns the buffer size used to carry out the decompression.
-=head2 Example
+=head2 Examples
Here is an example of using C<inflate>.
@@ -1120,7 +1286,7 @@ 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 ;
@@ -1131,6 +1297,46 @@ Here is an example of using C<inflate>.
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
@@ -1153,6 +1359,12 @@ CRC-related functions are available.
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
@@ -1199,7 +1411,7 @@ See the Changes file.
=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.
diff --git a/ext/Compress-Raw-Zlib/pod/FAQ.pod b/ext/Compress-Raw-Zlib/pod/FAQ.pod
index 0a78bbbdf4..56d08f5cfe 100644
--- a/ext/Compress-Raw-Zlib/pod/FAQ.pod
+++ b/ext/Compress-Raw-Zlib/pod/FAQ.pod
@@ -135,7 +135,7 @@ See the Changes file.
=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.
diff --git a/ext/Compress-Raw-Zlib/t/02zlib.t b/ext/Compress-Raw-Zlib/t/02zlib.t
index 889566afd4..7d379249b5 100644
--- a/ext/Compress-Raw-Zlib/t/02zlib.t
+++ b/ext/Compress-Raw-Zlib/t/02zlib.t
@@ -24,13 +24,13 @@ BEGIN
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;
@@ -443,10 +443,13 @@ for my $consume ( 0 .. 1)
# 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) ;
@@ -475,7 +478,6 @@ for my $consume ( 0 .. 1)
$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 ;
@@ -488,7 +490,7 @@ for my $consume ( 0 .. 1)
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 ;
@@ -499,8 +501,11 @@ for my $consume ( 0 .. 1)
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 ;
}
{
diff --git a/ext/Compress-Zlib/Makefile.PL b/ext/Compress-Zlib/Makefile.PL
deleted file mode 100755
index 1f6ba8060a..0000000000
--- a/ext/Compress-Zlib/Makefile.PL
+++ /dev/null
@@ -1,81 +0,0 @@
-#! 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
-
diff --git a/ext/Compress-Zlib/README b/ext/Compress-Zlib/README
deleted file mode 100644
index 89d1f07c77..0000000000
--- a/ext/Compress-Zlib/README
+++ /dev/null
@@ -1,120 +0,0 @@
-
- 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>
diff --git a/ext/Compress-Zlib/pod/FAQ.pod b/ext/Compress-Zlib/pod/FAQ.pod
deleted file mode 100644
index d590412f92..0000000000
--- a/ext/Compress-Zlib/pod/FAQ.pod
+++ /dev/null
@@ -1,125 +0,0 @@
-
-=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.
-
diff --git a/ext/Compress-Zlib/t/03zlib-v1.t b/ext/Compress-Zlib/t/03zlib-v1.t
deleted file mode 100644
index 7358f4a5f0..0000000000
--- a/ext/Compress-Zlib/t/03zlib-v1.t
+++ /dev/null
@@ -1,1188 +0,0 @@
-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";
-}
diff --git a/ext/Compress-Zlib/Changes b/ext/IO-Compress/Changes
index 931eea6e94..8e392c9931 100644
--- a/ext/Compress-Zlib/Changes
+++ b/ext/IO-Compress/Changes
@@ -1,6 +1,33 @@
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
@@ -11,31 +38,98 @@ CHANGES
* 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
- * No Changes
+ * 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
- * No Changes
+ * 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 #35341]
+ [RT #35342 & 35341]
2.009 20 April 2008
- * Minor documentation issue with flush.
- [rt.cpan.org #31446]
+ * 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
- 2.007 22 September 20007
+ * 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.
- * lib/Compress/Zlib.pm -- 1.x Backward Compatability issues
+ * 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
@@ -46,22 +140,77 @@ CHANGES
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.
+ * 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
+
- * 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
+ * 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
- * rewrote memGzip using IO::Compress::Gzip::gzip
+ * 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
@@ -71,10 +220,18 @@ CHANGES
* Documentation updates.
- * Fix append mode with gzopen.
- rt-cpan.org 24041
+ * Added IO::Handle to the ISA test in isaFilehandle
- * Allow gzopen to read from and write to a scalar reference.
+ * 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
@@ -82,34 +239,162 @@ CHANGES
2.000_14 26 October 2006
- * No changes.
+ * 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
- * No changes.
+ * 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.
- 2.000_12 16 April 2006
+ * Added Minimal option to IO::Compress::Zip.
+ This disables the creation of all extended fields.
- * Fixed gzread to zap the output buffer to an empty string when zero
+ * 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
- * No changes.
+ * 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
- * Changed gzread so that its behaviour matches C::Z::gzread 1.x if it
+ * 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
- * Posted to CPAN
+ * 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
@@ -159,6 +444,8 @@ CHANGES
* First Beta relase of Compress::zlib rewrite.
+Compress-Zlib version 1 Changes
+
1.38 - 6 September 2005
* Integrate core change 25304 -- Symbian Update
diff --git a/ext/IO-Compress/MANIFEST b/ext/IO-Compress/MANIFEST
new file mode 100644
index 0000000000..a229755fd4
--- /dev/null
+++ b/ext/IO-Compress/MANIFEST
@@ -0,0 +1,151 @@
+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
diff --git a/ext/IO_Compress_Base/Makefile.PL b/ext/IO-Compress/Makefile.PL
index 751442ae30..b939d5924c 100644
--- a/ext/IO_Compress_Base/Makefile.PL
+++ b/ext/IO-Compress/Makefile.PL
@@ -3,14 +3,16 @@
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',
@@ -21,7 +23,8 @@ WriteMakefile(
(
$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)
: () }
@@ -30,24 +33,15 @@ WriteMakefile(
(
$] >= 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
-
diff --git a/ext/IO_Compress_Base/README b/ext/IO-Compress/README
index 0cfa8730de..07ae661601 100644
--- a/ext/IO_Compress_Base/README
+++ b/ext/IO-Compress/README
@@ -1,27 +1,31 @@
- 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
-------------------
@@ -36,7 +40,7 @@ using this sequence of commands:
INSTALLATION
------------
-To install IO-Compress-Base, run the command below:
+To install IO-Compress, run the command below:
make install
@@ -46,7 +50,7 @@ TROUBLESHOOTING
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:
@@ -63,23 +67,23 @@ 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]
diff --git a/ext/Compress-Zlib/examples/filtdef b/ext/IO-Compress/examples/compress-zlib/filtdef
index 57dfeb9068..57dfeb9068 100755
--- a/ext/Compress-Zlib/examples/filtdef
+++ b/ext/IO-Compress/examples/compress-zlib/filtdef
diff --git a/ext/Compress-Zlib/examples/filtinf b/ext/IO-Compress/examples/compress-zlib/filtinf
index 1df202b1d7..1df202b1d7 100755
--- a/ext/Compress-Zlib/examples/filtinf
+++ b/ext/IO-Compress/examples/compress-zlib/filtinf
diff --git a/ext/Compress-Zlib/examples/gzcat b/ext/IO-Compress/examples/compress-zlib/gzcat
index 5241a5a11f..5241a5a11f 100755
--- a/ext/Compress-Zlib/examples/gzcat
+++ b/ext/IO-Compress/examples/compress-zlib/gzcat
diff --git a/ext/Compress-Zlib/examples/gzgrep b/ext/IO-Compress/examples/compress-zlib/gzgrep
index 324d3e615f..324d3e615f 100755
--- a/ext/Compress-Zlib/examples/gzgrep
+++ b/ext/IO-Compress/examples/compress-zlib/gzgrep
diff --git a/ext/Compress-Zlib/examples/gzstream b/ext/IO-Compress/examples/compress-zlib/gzstream
index faacb0a0dd..faacb0a0dd 100755
--- a/ext/Compress-Zlib/examples/gzstream
+++ b/ext/IO-Compress/examples/compress-zlib/gzstream
diff --git a/ext/IO-Compress/examples/io/anycat b/ext/IO-Compress/examples/io/anycat
new file mode 100755
index 0000000000..9db9c41faf
--- /dev/null
+++ b/ext/IO-Compress/examples/io/anycat
@@ -0,0 +1,17 @@
+#!/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" ;
+
+}
diff --git a/ext/IO-Compress/examples/io/bzip2/bzcat b/ext/IO-Compress/examples/io/bzip2/bzcat
new file mode 100755
index 0000000000..7d7464377a
--- /dev/null
+++ b/ext/IO-Compress/examples/io/bzip2/bzcat
@@ -0,0 +1,29 @@
+#!/usr/local/bin/perl
+
+use IO::Uncompress::Bunzip2 qw( $Bunzip2Error );
+use strict ;
+local ($^W) = 1; #use warnings ;
+
+#die "Usage: gzcat file...\n"
+# unless @ARGV ;
+
+my $file ;
+my $buffer ;
+my $s;
+
+@ARGV = '-' unless @ARGV ;
+
+foreach $file (@ARGV) {
+
+ 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: $Bunzip2Error\n"
+ if $s < 0 ;
+
+ $gz->close() ;
+}
+
diff --git a/ext/IO-Compress/examples/io/bzip2/bzgrep b/ext/IO-Compress/examples/io/bzip2/bzgrep
new file mode 100755
index 0000000000..1ac162ca41
--- /dev/null
+++ b/ext/IO-Compress/examples/io/bzip2/bzgrep
@@ -0,0 +1,25 @@
+#!/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 ;
+}
diff --git a/ext/IO-Compress/examples/io/bzip2/bzstream b/ext/IO-Compress/examples/io/bzip2/bzstream
new file mode 100755
index 0000000000..9bba3a5c4f
--- /dev/null
+++ b/ext/IO-Compress/examples/io/bzip2/bzstream
@@ -0,0 +1,9 @@
+#!/usr/local/bin/perl
+
+use strict ;
+local ($^W) = 1; #use warnings ;
+use IO::Compress::Bzip2 qw(:all);
+
+bzip2 '-' => '-'
+ or die "bzstream: $Bzip2Error\n" ;
+
diff --git a/ext/IO_Compress_Zlib/examples/gzappend b/ext/IO-Compress/examples/io/gzip/gzappend
index a4a60a9aad..a4a60a9aad 100644
--- a/ext/IO_Compress_Zlib/examples/gzappend
+++ b/ext/IO-Compress/examples/io/gzip/gzappend
diff --git a/ext/IO_Compress_Zlib/examples/gzcat b/ext/IO-Compress/examples/io/gzip/gzcat
index 5572bae959..5572bae959 100755
--- a/ext/IO_Compress_Zlib/examples/gzcat
+++ b/ext/IO-Compress/examples/io/gzip/gzcat
diff --git a/ext/IO_Compress_Zlib/examples/gzgrep b/ext/IO-Compress/examples/io/gzip/gzgrep
index 33820ba064..33820ba064 100755
--- a/ext/IO_Compress_Zlib/examples/gzgrep
+++ b/ext/IO-Compress/examples/io/gzip/gzgrep
diff --git a/ext/IO_Compress_Zlib/examples/gzstream b/ext/IO-Compress/examples/io/gzip/gzstream
index 9d03bc5749..9d03bc5749 100755
--- a/ext/IO_Compress_Zlib/examples/gzstream
+++ b/ext/IO-Compress/examples/io/gzip/gzstream
diff --git a/ext/Compress-Zlib/lib/Compress/Zlib.pm b/ext/IO-Compress/lib/Compress/Zlib.pm
index 7c712f6330..a95775282f 100644
--- a/ext/Compress-Zlib/lib/Compress/Zlib.pm
+++ b/ext/IO-Compress/lib/Compress/Zlib.pm
@@ -8,17 +8,17 @@ use Carp ;
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;
@@ -452,7 +452,7 @@ sub inflate
package Compress::Zlib ;
-use IO::Compress::Gzip::Constants 2.015 ;
+use IO::Compress::Gzip::Constants 2.017 ;
sub memGzip($)
{
@@ -632,8 +632,7 @@ Compress::Zlib - Interface to zlib compression library
$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
@@ -1406,6 +1405,12 @@ CRC-related functions are available.
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
@@ -1444,7 +1449,7 @@ See the Changes file.
=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.
diff --git a/ext/IO_Compress_Base/lib/File/GlobMapper.pm b/ext/IO-Compress/lib/File/GlobMapper.pm
index 40a606309e..40a606309e 100644
--- a/ext/IO_Compress_Base/lib/File/GlobMapper.pm
+++ b/ext/IO-Compress/lib/File/GlobMapper.pm
diff --git a/ext/IO-Compress/lib/IO/Compress/Adapter/Bzip2.pm b/ext/IO-Compress/lib/IO/Compress/Adapter/Bzip2.pm
new file mode 100644
index 0000000000..7e6b0199b4
--- /dev/null
+++ b/ext/IO-Compress/lib/IO/Compress/Adapter/Bzip2.pm
@@ -0,0 +1,162 @@
+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__
+
diff --git a/ext/IO_Compress_Zlib/lib/IO/Compress/Adapter/Deflate.pm b/ext/IO-Compress/lib/IO/Compress/Adapter/Deflate.pm
index 4425e3670d..bbd0ed5ad7 100644
--- a/ext/IO_Compress_Zlib/lib/IO/Compress/Adapter/Deflate.pm
+++ b/ext/IO-Compress/lib/IO/Compress/Adapter/Deflate.pm
@@ -4,12 +4,12 @@ use strict;
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
{
diff --git a/ext/IO_Compress_Zlib/lib/IO/Compress/Adapter/Identity.pm b/ext/IO-Compress/lib/IO/Compress/Adapter/Identity.pm
index 1b1998e120..e6f33a3612 100644
--- a/ext/IO_Compress_Zlib/lib/IO/Compress/Adapter/Identity.pm
+++ b/ext/IO-Compress/lib/IO/Compress/Adapter/Identity.pm
@@ -4,10 +4,10 @@ use strict;
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
{
diff --git a/ext/IO_Compress_Base/lib/IO/Compress/Base.pm b/ext/IO-Compress/lib/IO/Compress/Base.pm
index 484c0cfb77..7d00becc11 100644
--- a/ext/IO_Compress_Base/lib/IO/Compress/Base.pm
+++ b/ext/IO-Compress/lib/IO/Compress/Base.pm
@@ -6,7 +6,7 @@ require 5.004 ;
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);
@@ -20,7 +20,7 @@ use bytes;
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.
@@ -217,8 +217,9 @@ sub _create
}
# 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" ) }
@@ -260,6 +261,7 @@ sub _create
}
}
elsif ($outType eq 'filename') {
+ no warnings;
my $mode = '>' ;
$mode = '>>'
if $appendOutput;
@@ -299,8 +301,8 @@ sub ckOutputParam
$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] });
@@ -972,7 +974,7 @@ See the Changes file.
=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.
diff --git a/ext/IO_Compress_Base/lib/IO/Compress/Base/Common.pm b/ext/IO-Compress/lib/IO/Compress/Base/Common.pm
index d35a4dff7d..756cf4b38d 100644
--- a/ext/IO_Compress_Base/lib/IO/Compress/Base/Common.pm
+++ b/ext/IO-Compress/lib/IO/Compress/Base/Common.pm
@@ -11,7 +11,7 @@ use File::GlobMapper;
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
diff --git a/ext/IO-Compress/lib/IO/Compress/Bzip2.pm b/ext/IO-Compress/lib/IO/Compress/Bzip2.pm
new file mode 100644
index 0000000000..356ba1a2c4
--- /dev/null
+++ b/ext/IO-Compress/lib/IO/Compress/Bzip2.pm
@@ -0,0 +1,758 @@
+package IO::Compress::Bzip2 ;
+
+use strict ;
+use warnings;
+use bytes;
+require Exporter ;
+
+use IO::Compress::Base 2.016 ;
+
+use IO::Compress::Base::Common 2.016 qw(createSelfTiedObject);
+use IO::Compress::Adapter::Bzip2 2.016 ;
+
+
+
+our ($VERSION, @ISA, @EXPORT_OK, %EXPORT_TAGS, $Bzip2Error);
+
+$VERSION = '2.016';
+$Bzip2Error = '';
+
+@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, \$Bzip2Error);
+ return $obj->_create(undef, @_);
+}
+
+sub bzip2
+{
+ my $obj = createSelfTiedObject(undef, \$Bzip2Error);
+ $obj->_def(@_);
+}
+
+
+sub mkHeader
+{
+ my $self = shift ;
+ return '';
+
+}
+
+sub getExtraParams
+{
+ my $self = shift ;
+
+ 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],
+ );
+}
+
+
+
+sub ckParams
+{
+ my $self = shift ;
+ 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;
+
+ }
+
+ # 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;
+ }
+
+ return 1 ;
+}
+
+
+sub mkComp
+{
+ my $self = 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;
+
+ return $obj;
+}
+
+
+sub mkTrailer
+{
+ my $self = shift ;
+ return '';
+}
+
+sub mkFinalTrailer
+{
+ return '';
+}
+
+#sub newHeader
+#{
+# my $self = shift ;
+# return '';
+#}
+
+sub getInverseClass
+{
+ return ('IO::Uncompress::Bunzip2');
+}
+
+sub getFileInfo
+{
+ my $self = shift ;
+ my $params = shift;
+ my $file = shift ;
+
+}
+
+1;
+
+__END__
+
+=head1 NAME
+
+IO::Compress::Bzip2 - Write bzip2 files/buffers
+
+
+
+=head1 SYNOPSIS
+
+ use IO::Compress::Bzip2 qw(bzip2 $Bzip2Error) ;
+
+ my $status = bzip2 $input => $output [,OPTS]
+ or die "bzip2 failed: $Bzip2Error\n";
+
+ my $z = new IO::Compress::Bzip2 $output [,OPTS]
+ or die "bzip2 failed: $Bzip2Error\n";
+
+ $z->print($string);
+ $z->printf($format, $string);
+ $z->write($string);
+ $z->syswrite($string [, $length, $offset]);
+ $z->flush();
+ $z->tell();
+ $z->eof();
+ $z->seek($position, $whence);
+ $z->binmode();
+ $z->fileno();
+ $z->opened();
+ $z->autoflush();
+ $z->input_line_number();
+ $z->newStream( [OPTS] );
+
+ $z->close() ;
+
+ $Bzip2Error ;
+
+ # IO::File mode
+
+ print $z $string;
+ printf $z $format, $string;
+ tell $z
+ eof $z
+ seek $z, $position, $whence
+ binmode $z
+ fileno $z
+ close $z ;
+
+
+=head1 DESCRIPTION
+
+This module provides a Perl interface that allows writing bzip2
+compressed data to files or buffer.
+
+For reading bzip2 files/buffers, see the companion module
+L<IO::Uncompress::Bunzip2|IO::Uncompress::Bunzip2>.
+
+=head1 Functional Interface
+
+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::Bzip2 qw(bzip2 $Bzip2Error) ;
+
+ bzip2 $input => $output [,OPTS]
+ or die "bzip2 failed: $Bzip2Error\n";
+
+The functional interface needs Perl5.005 or better.
+
+=head2 bzip2 $input => $output [, OPTS]
+
+C<bzip2> expects at least two parameters, C<$input> and C<$output>.
+
+=head3 The C<$input> parameter
+
+The parameter, C<$input>, is used to define the source of
+the uncompressed data.
+
+It can take one of the following forms:
+
+=over 5
+
+=item A filename
+
+If the C<$input> parameter is a simple scalar, it is assumed to be a
+filename. This file will be opened for reading and the input data
+will be read from it.
+
+=item A filehandle
+
+If the C<$input> parameter is a filehandle, the input data will be
+read from it.
+The string '-' can be used as an alias for standard input.
+
+=item A scalar reference
+
+If C<$input> is a scalar reference, the input data will be read
+from C<$$input>.
+
+=item An array reference
+
+If C<$input> is an array reference, each element in the array must be a
+filename.
+
+The input data will be read from each file in turn.
+
+The complete array will be walked to ensure that it only
+contains valid filenames before any data is compressed.
+
+=item An Input FileGlob string
+
+If C<$input> is a string that is delimited by the characters "<" and ">"
+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 ...
+
+See L<File::GlobMapper|File::GlobMapper> for more details.
+
+=back
+
+If the C<$input> parameter is any other type, C<undef> will be returned.
+
+=head3 The C<$output> parameter
+
+The parameter C<$output> is used to control the destination of the
+compressed data. This parameter can take one of these forms.
+
+=over 5
+
+=item A filename
+
+If the C<$output> parameter is a simple scalar, it is assumed to be a
+filename. This file will be opened for writing and the compressed
+data will be written to it.
+
+=item A filehandle
+
+If the C<$output> parameter is a filehandle, the compressed data
+will be written to it.
+The string '-' can be used as an alias for standard output.
+
+=item A scalar reference
+
+If C<$output> is a scalar reference, the compressed data will be
+stored in C<$$output>.
+
+=item An Array Reference
+
+If C<$output> is an array reference, the compressed data will be
+pushed onto the array.
+
+=item An Output FileGlob
+
+If C<$output> is a string that is delimited by the characters "<" and ">"
+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
+string. Anything else is an error.
+
+=back
+
+If the C<$output> parameter is any other type, C<undef> will be returned.
+
+=head2 Notes
+
+When C<$input> maps to multiple files/buffers and C<$output> is a single
+file/buffer the input files/buffers will be stored
+in C<$output> as a concatenated series of compressed data streams.
+
+=head2 Optional Parameters
+
+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.
+
+=over 5
+
+=item C<< AutoClose => 0|1 >>
+
+This option applies to any input or output data streams to
+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<bzip2> has
+completed.
+
+This parameter defaults to 0.
+
+=item C<< BinModeIn => 0|1 >>
+
+When reading from a file or filehandle, set C<binmode> before reading.
+
+Defaults to 0.
+
+=item C<< Append => 0|1 >>
+
+TODO
+
+=back
+
+=head2 Examples
+
+To read the contents of the file C<file1.txt> and write the compressed
+data to the file C<file1.txt.bz2>.
+
+ use strict ;
+ use warnings ;
+ use IO::Compress::Bzip2 qw(bzip2 $Bzip2Error) ;
+
+ my $input = "file1.txt";
+ 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::Bzip2 qw(bzip2 $Bzip2Error) ;
+ use IO::File ;
+
+ my $input = new IO::File "<file1.txt"
+ or die "Cannot open 'file1.txt': $!\n" ;
+ my $buffer ;
+ 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::Bzip2 qw(bzip2 $Bzip2Error) ;
+
+ 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::Bzip2 qw(bzip2 $Bzip2Error) ;
+
+ for my $input ( glob "/my/home/*.txt" )
+ {
+ 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::Bzip2> is shown below
+
+ my $z = new IO::Compress::Bzip2 $output [,OPTS]
+ or die "IO::Compress::Bzip2 failed: $Bzip2Error\n";
+
+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::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
+these forms
+
+ $z->print("hello world\n");
+ print $z "hello world\n";
+
+The mandatory parameter C<$output> is used to control the destination
+of the compressed data. This parameter can take one of these forms.
+
+=over 5
+
+=item A filename
+
+If the C<$output> parameter is a simple scalar, it is assumed to be a
+filename. This file will be opened for writing and the compressed data
+will be written to it.
+
+=item A filehandle
+
+If the C<$output> parameter is a filehandle, the compressed data will be
+written to it.
+The string '-' can be used as an alias for standard output.
+
+=item A scalar reference
+
+If C<$output> is a scalar reference, the compressed data will be stored
+in C<$$output>.
+
+=back
+
+If the C<$output> parameter is any other type, C<IO::Compress::Bzip2>::new will
+return undef.
+
+=head2 Constructor Options
+
+C<OPTS> is any combination of the following options:
+
+=over 5
+
+=item C<< AutoClose => 0|1 >>
+
+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::Bzip2>
+object is destroyed.
+
+This parameter defaults to 0.
+
+=item C<< Append => 0|1 >>
+
+Opens C<$output> in append mode.
+
+The behaviour of this option is dependent on the type of C<$output>.
+
+=over 5
+
+=item * A Buffer
+
+If C<$output> is a buffer and C<Append> is enabled, all compressed data
+will be append to the end if C<$output>. Otherwise C<$output> will be
+cleared before any data is written to it.
+
+=item * A Filename
+
+If C<$output> is a filename and C<Append> is enabled, the file will be
+opened in append mode. Otherwise the contents of the file, if any, will be
+truncated before any compressed data is written to it.
+
+=item * A Filehandle
+
+If C<$output> is a filehandle, the file pointer will be positioned to the
+end of the file via a call to C<seek> before any compressed data is written
+to it. Otherwise the file pointer will not be moved.
+
+=back
+
+This parameter defaults to 0.
+
+=item C<< BlockSize100K => number >>
+
+Specify the number of 100K blocks bzip2 uses during compression.
+
+Valid values are from 1 to 9, where 9 is best compression.
+
+The default is 1.
+
+=item C<< WorkFactor => number >>
+
+Specifies how much effort bzip2 should take before resorting to a slower
+fallback compression algorithm.
+
+Valid values range from 0 to 250, where 0 means use the default value 30.
+
+The default is 0.
+
+=item C<< Strict => 0|1 >>
+
+This is a placeholder option.
+
+=back
+
+=head2 Examples
+
+TODO
+
+=head1 Methods
+
+=head2 print
+
+Usage is
+
+ $z->print($data)
+ print $z $data
+
+Compresses and outputs the contents of the C<$data> parameter. This
+has the same behaviour as the C<print> built-in.
+
+Returns true if successful.
+
+=head2 printf
+
+Usage is
+
+ $z->printf($format, $data)
+ printf $z $format, $data
+
+Compresses and outputs the contents of the C<$data> parameter.
+
+Returns true if successful.
+
+=head2 syswrite
+
+Usage is
+
+ $z->syswrite $data
+ $z->syswrite $data, $length
+ $z->syswrite $data, $length, $offset
+
+Compresses and outputs the contents of the C<$data> parameter.
+
+Returns the number of uncompressed bytes written, or C<undef> if
+unsuccessful.
+
+=head2 write
+
+Usage is
+
+ $z->write $data
+ $z->write $data, $length
+ $z->write $data, $length, $offset
+
+Compresses and outputs the contents of the C<$data> parameter.
+
+Returns the number of uncompressed bytes written, or C<undef> if
+unsuccessful.
+
+=head2 flush
+
+Usage is
+
+ $z->flush;
+
+Flushes any pending compressed data to the output file/buffer.
+
+TODO
+
+Returns true on success.
+
+=head2 tell
+
+Usage is
+
+ $z->tell()
+ tell $z
+
+Returns the uncompressed file offset.
+
+=head2 eof
+
+Usage is
+
+ $z->eof();
+ eof($z);
+
+Returns true if the C<close> method has been called.
+
+=head2 seek
+
+ $z->seek($position, $whence);
+ seek($z, $position, $whence);
+
+Provides a sub-set of the C<seek> functionality, with the restriction
+that it is only legal to seek forward in the output file/buffer.
+It is a fatal error to attempt to seek backward.
+
+Empty parts of the file/buffer will have NULL (0x00) bytes written to them.
+
+The C<$whence> parameter takes one the usual values, namely SEEK_SET,
+SEEK_CUR or SEEK_END.
+
+Returns 1 on success, 0 on failure.
+
+=head2 binmode
+
+Usage is
+
+ $z->binmode
+ binmode $z ;
+
+This is a noop provided for completeness.
+
+=head2 opened
+
+ $z->opened()
+
+Returns true if the object currently refers to a opened file/buffer.
+
+=head2 autoflush
+
+ my $prev = $z->autoflush()
+ my $prev = $z->autoflush(EXPR)
+
+If the C<$z> object is associated with a file or a filehandle, this method
+returns the current autoflush setting for the underlying filehandle. If
+C<EXPR> is present, and is non-zero, it will enable flushing after every
+write/print operation.
+
+If C<$z> is associated with a buffer, this method has no effect and always
+returns C<undef>.
+
+B<Note> that the special variable C<$|> B<cannot> be used to set or
+retrieve the autoflush setting.
+
+=head2 input_line_number
+
+ $z->input_line_number()
+ $z->input_line_number(EXPR)
+
+This method always returns C<undef> when compressing.
+
+=head2 fileno
+
+ $z->fileno()
+ fileno($z)
+
+If the C<$z> object is associated with a file or a filehandle, C<fileno>
+will return the underlying file descriptor. Once the C<close> method is
+called C<fileno> will return C<undef>.
+
+If the C<$z> object is is associated with a buffer, this method will return
+C<undef>.
+
+=head2 close
+
+ $z->close() ;
+ close $z ;
+
+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::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
+not until global destruction of all live objects when the program is
+terminating.
+
+Therefore, if you want your scripts to be able to run on all versions
+of Perl, you should call C<close> explicitly and not rely on automatic
+closing.
+
+Returns true on success, otherwise 0.
+
+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.
+
+=head2 newStream([OPTS])
+
+Usage is
+
+ $z->newStream( [OPTS] )
+
+Closes the current compressed data stream and starts a new one.
+
+OPTS consists of any of the the options that are available when creating
+the C<$z> object.
+
+See the L</"Constructor Options"> section for more details.
+
+=head1 Importing
+
+No symbolic constants are required by this IO::Compress::Bzip2 at present.
+
+=over 5
+
+=item :all
+
+Imports C<bzip2> and C<$Bzip2Error>.
+Same as doing this
+
+ use IO::Compress::Bzip2 qw(bzip2 $Bzip2Error) ;
+
+
+
+=back
+
+=head1 EXAMPLES
+
+=head2 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::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::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<File::GlobMapper|File::GlobMapper>, L<Archive::Zip|Archive::Zip>,
+L<Archive::Tar|Archive::Tar>,
+L<IO::Zlib|IO::Zlib>
+
+The primary site for the bzip2 program is F<http://www.bzip.org>.
+
+See the module L<Compress::Bzip2|Compress::Bzip2>
+
+=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.
+
diff --git a/ext/IO_Compress_Zlib/lib/IO/Compress/Deflate.pm b/ext/IO-Compress/lib/IO/Compress/Deflate.pm
index fae42bf3db..05466f3a66 100644
--- a/ext/IO_Compress_Zlib/lib/IO/Compress/Deflate.pm
+++ b/ext/IO-Compress/lib/IO/Compress/Deflate.pm
@@ -6,16 +6,16 @@ use bytes;
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);
@@ -841,13 +841,13 @@ These symbolic constants are used by the C<Strategy> option in the constructor.
=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
@@ -882,7 +882,7 @@ See the Changes file.
=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.
diff --git a/ext/IO_Compress_Zlib/lib/IO/Compress/Gzip.pm b/ext/IO-Compress/lib/IO/Compress/Gzip.pm
index dfd41e3374..cbdc985b1e 100644
--- a/ext/IO_Compress_Zlib/lib/IO/Compress/Gzip.pm
+++ b/ext/IO-Compress/lib/IO/Compress/Gzip.pm
@@ -8,12 +8,12 @@ use warnings;
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
{
@@ -27,7 +27,7 @@ require Exporter ;
our ($VERSION, @ISA, @EXPORT_OK, %EXPORT_TAGS, $GzipError);
-$VERSION = '2.015';
+$VERSION = '2.017';
$GzipError = '' ;
@ISA = qw(Exporter IO::Compress::RawDeflate);
@@ -1153,13 +1153,13 @@ These symbolic constants are used by the C<Strategy> option in the constructor.
=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
@@ -1194,7 +1194,7 @@ See the Changes file.
=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.
diff --git a/ext/IO_Compress_Zlib/lib/IO/Compress/Gzip/Constants.pm b/ext/IO-Compress/lib/IO/Compress/Gzip/Constants.pm
index ac38b97894..9353fd904c 100644
--- a/ext/IO_Compress_Zlib/lib/IO/Compress/Gzip/Constants.pm
+++ b/ext/IO-Compress/lib/IO/Compress/Gzip/Constants.pm
@@ -9,7 +9,7 @@ require Exporter;
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);
diff --git a/ext/IO_Compress_Zlib/lib/IO/Compress/RawDeflate.pm b/ext/IO-Compress/lib/IO/Compress/RawDeflate.pm
index 5540d4c34d..6daed655c5 100644
--- a/ext/IO_Compress_Zlib/lib/IO/Compress/RawDeflate.pm
+++ b/ext/IO-Compress/lib/IO/Compress/RawDeflate.pm
@@ -7,16 +7,16 @@ use warnings;
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);
@@ -142,8 +142,8 @@ sub getZlibParams
{
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 (
@@ -928,13 +928,13 @@ These symbolic constants are used by the C<Strategy> option in the constructor.
=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
@@ -969,7 +969,7 @@ See the Changes file.
=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.
diff --git a/ext/IO_Compress_Zlib/lib/IO/Compress/Zip.pm b/ext/IO-Compress/lib/IO/Compress/Zip.pm
index 976ec484cb..73b158a62e 100644
--- a/ext/IO_Compress_Zlib/lib/IO/Compress/Zip.pm
+++ b/ext/IO-Compress/lib/IO/Compress/Zip.pm
@@ -4,22 +4,27 @@ use strict ;
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 ;
+# } ;
}
@@ -27,7 +32,7 @@ require Exporter ;
our ($VERSION, @ISA, @EXPORT_OK, %EXPORT_TAGS, $ZipError);
-$VERSION = '2.015';
+$VERSION = '2.017';
$ZipError = '';
@ISA = qw(Exporter IO::Compress::RawDeflate);
@@ -83,6 +88,11 @@ sub mkComp
);
*$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;
@@ -146,13 +156,13 @@ sub mkHeader
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;
@@ -418,6 +428,10 @@ sub ckParams
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') ;
@@ -452,8 +466,8 @@ sub getExtraParams
{
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 = ();
@@ -1464,13 +1478,13 @@ constructor.
=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
@@ -1505,7 +1519,7 @@ See the Changes file.
=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.
diff --git a/ext/IO_Compress_Zlib/lib/IO/Compress/Zip/Constants.pm b/ext/IO-Compress/lib/IO/Compress/Zip/Constants.pm
index ead53978b8..201c6ac619 100644
--- a/ext/IO_Compress_Zlib/lib/IO/Compress/Zip/Constants.pm
+++ b/ext/IO-Compress/lib/IO/Compress/Zip/Constants.pm
@@ -7,7 +7,7 @@ require Exporter;
our ($VERSION, @ISA, @EXPORT, %ZIP_CM_MIN_VERSIONS);
-$VERSION = '2.015';
+$VERSION = '2.017';
@ISA = qw(Exporter);
diff --git a/ext/IO_Compress_Zlib/lib/IO/Compress/Zlib/Constants.pm b/ext/IO-Compress/lib/IO/Compress/Zlib/Constants.pm
index bf2eb22555..fcf2470999 100644
--- a/ext/IO_Compress_Zlib/lib/IO/Compress/Zlib/Constants.pm
+++ b/ext/IO-Compress/lib/IO/Compress/Zlib/Constants.pm
@@ -9,7 +9,7 @@ require Exporter;
our ($VERSION, @ISA, @EXPORT);
-$VERSION = '2.015';
+$VERSION = '2.017';
@ISA = qw(Exporter);
diff --git a/ext/IO_Compress_Zlib/lib/IO/Compress/Zlib/Extra.pm b/ext/IO-Compress/lib/IO/Compress/Zlib/Extra.pm
index 1c02d18d9f..7dd4f0222b 100644
--- a/ext/IO_Compress_Zlib/lib/IO/Compress/Zlib/Extra.pm
+++ b/ext/IO-Compress/lib/IO/Compress/Zlib/Extra.pm
@@ -8,9 +8,9 @@ use bytes;
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
{
diff --git a/ext/IO-Compress/lib/IO/Uncompress/Adapter/Bunzip2.pm b/ext/IO-Compress/lib/IO/Uncompress/Adapter/Bunzip2.pm
new file mode 100644
index 0000000000..680dbfc9eb
--- /dev/null
+++ b/ext/IO-Compress/lib/IO/Uncompress/Adapter/Bunzip2.pm
@@ -0,0 +1,199 @@
+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__
+
diff --git a/ext/IO_Compress_Zlib/lib/IO/Uncompress/Adapter/Identity.pm b/ext/IO-Compress/lib/IO/Uncompress/Adapter/Identity.pm
index ed96393f55..887f7d2a69 100644..100755
--- a/ext/IO_Compress_Zlib/lib/IO/Uncompress/Adapter/Identity.pm
+++ b/ext/IO-Compress/lib/IO/Uncompress/Adapter/Identity.pm
@@ -4,13 +4,13 @@ use warnings;
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
{
diff --git a/ext/IO_Compress_Zlib/lib/IO/Uncompress/Adapter/Inflate.pm b/ext/IO-Compress/lib/IO/Uncompress/Adapter/Inflate.pm
index d87b9f5e26..3758b58e2b 100644
--- a/ext/IO_Compress_Zlib/lib/IO/Uncompress/Adapter/Inflate.pm
+++ b/ext/IO-Compress/lib/IO/Uncompress/Adapter/Inflate.pm
@@ -4,11 +4,11 @@ use strict;
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';
@@ -24,6 +24,7 @@ sub mkUncompObject
if ($scan)
{
($inflate, $status) = new Compress::Raw::Zlib::InflateScan
+ #LimitOutput => 1,
CRC32 => $crc32,
ADLER32 => $adler32,
WindowBits => - MAX_WBITS ;
@@ -32,6 +33,7 @@ sub mkUncompObject
{
($inflate, $status) = new Compress::Raw::Zlib::Inflate
AppendOutput => 1,
+ LimitOutput => 1,
CRC32 => $crc32,
ADLER32 => $adler32,
WindowBits => - MAX_WBITS ;
@@ -60,19 +62,13 @@ sub uncompr
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 ;
diff --git a/ext/IO_Compress_Zlib/lib/IO/Uncompress/AnyInflate.pm b/ext/IO-Compress/lib/IO/Uncompress/AnyInflate.pm
index f350f32238..577a5de68f 100644
--- a/ext/IO_Compress_Zlib/lib/IO/Uncompress/AnyInflate.pm
+++ b/ext/IO-Compress/lib/IO/Uncompress/AnyInflate.pm
@@ -6,22 +6,22 @@ use strict;
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 );
@@ -48,7 +48,7 @@ sub anyinflate
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] ) ;
}
@@ -939,7 +939,7 @@ See the Changes file.
=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.
diff --git a/ext/IO_Compress_Base/lib/IO/Uncompress/AnyUncompress.pm b/ext/IO-Compress/lib/IO/Uncompress/AnyUncompress.pm
index bdd28222f7..e7b36c8702 100644
--- a/ext/IO_Compress_Base/lib/IO/Uncompress/AnyUncompress.pm
+++ b/ext/IO-Compress/lib/IO/Uncompress/AnyUncompress.pm
@@ -4,16 +4,16 @@ use strict;
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 );
@@ -27,18 +27,20 @@ Exporter::export_ok_tags('all');
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
@@ -56,7 +58,7 @@ sub anyuncompress
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] ) ;
}
@@ -103,6 +105,25 @@ sub mkUncomp
}
}
+# 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)
@@ -915,7 +936,7 @@ See the Changes file.
=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.
diff --git a/ext/IO_Compress_Base/lib/IO/Uncompress/Base.pm b/ext/IO-Compress/lib/IO/Uncompress/Base.pm
index faeb8232ed..09e440ed66 100644
--- a/ext/IO_Compress_Base/lib/IO/Uncompress/Base.pm
+++ b/ext/IO-Compress/lib/IO/Uncompress/Base.pm
@@ -9,12 +9,12 @@ our (@ISA, $VERSION, @EXPORT_OK, %EXPORT_TAGS);
@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 ;
@@ -410,6 +410,7 @@ sub _create
if $got->value('Scan');
}
else {
+ no warnings ;
my $mode = '<';
$mode = '+<' if $got->value('Scan');
*$obj->{StdIO} = ($inValue eq '-');
@@ -502,17 +503,17 @@ sub ckInputParam
$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;
}
@@ -715,6 +716,9 @@ sub _rd2
$x->{buff} = \$buff;
}
+ last if $status < 0 || $z->smartEof();
+ #last if $status < 0 ;
+
last
unless *$self->{MultiStream};
@@ -849,9 +853,14 @@ sub _raw_read
$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;
@@ -874,8 +883,8 @@ sub _raw_read
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} ;
@@ -1081,6 +1090,7 @@ sub read
# 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)
@@ -1336,6 +1346,7 @@ sub seek
last if $offset == 0 ;
}
+ $here = $self->tell() ;
return $offset == 0 ? 1 : 0 ;
}
@@ -1448,9 +1459,8 @@ See the Changes file.
=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.
-
diff --git a/ext/IO-Compress/lib/IO/Uncompress/Bunzip2.pm b/ext/IO-Compress/lib/IO/Uncompress/Bunzip2.pm
new file mode 100644
index 0000000000..5fb1879e95
--- /dev/null
+++ b/ext/IO-Compress/lib/IO/Uncompress/Bunzip2.pm
@@ -0,0 +1,858 @@
+package IO::Uncompress::Bunzip2 ;
+
+use strict ;
+use warnings;
+use bytes;
+
+use IO::Compress::Base::Common 2.016 qw(:Status createSelfTiedObject);
+
+use IO::Uncompress::Base 2.016 ;
+use IO::Uncompress::Adapter::Bunzip2 2.016 ;
+
+require Exporter ;
+our ($VERSION, @ISA, @EXPORT_OK, %EXPORT_TAGS, $Bunzip2Error);
+
+$VERSION = '2.016';
+$Bunzip2Error = '';
+
+@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');
+
+
+sub new
+{
+ my $class = shift ;
+ my $obj = createSelfTiedObject($class, \$Bunzip2Error);
+
+ $obj->_create(undef, 0, @_);
+}
+
+sub bunzip2
+{
+ my $obj = createSelfTiedObject(undef, \$Bunzip2Error);
+ return $obj->_inf(@_);
+}
+
+sub getExtraParams
+{
+ 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 ;
+
+ 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, 4);
+
+ *$self->{HeaderPending} = $magic ;
+
+ return $self->HeaderError("Header size is " .
+ 4 . " bytes")
+ if length $magic != 4;
+
+ return $self->HeaderError("Bad Magic.")
+ if ! isBzip2Magic($magic) ;
+
+
+ *$self->{Type} = 'bzip2';
+ return $magic;
+}
+
+sub readHeader
+{
+ my $self = shift;
+ my $magic = shift ;
+
+ $self->pushBack($magic);
+ *$self->{HeaderPending} = '';
+
+
+ return {
+ 'Type' => 'bzip2',
+ 'FingerprintLength' => 4,
+ 'HeaderLength' => 4,
+ 'TrailerLength' => 0,
+ 'Header' => '$magic'
+ };
+
+}
+
+sub chkTrailer
+{
+ return STATUS_OK;
+}
+
+
+
+sub isBzip2Magic
+{
+ my $buffer = shift ;
+ return $buffer =~ /^BZh\d$/;
+}
+
+1 ;
+
+__END__
+
+
+=head1 NAME
+
+IO::Uncompress::Bunzip2 - Read bzip2 files/buffers
+
+=head1 SYNOPSIS
+
+ use IO::Uncompress::Bunzip2 qw(bunzip2 $Bunzip2Error) ;
+
+ my $status = bunzip2 $input => $output [,OPTS]
+ or die "bunzip2 failed: $Bunzip2Error\n";
+
+ my $z = new IO::Uncompress::Bunzip2 $input [OPTS]
+ or die "bunzip2 failed: $Bunzip2Error\n";
+
+ $status = $z->read($buffer)
+ $status = $z->read($buffer, $length)
+ $status = $z->read($buffer, $length, $offset)
+ $line = $z->getline()
+ $char = $z->getc()
+ $char = $z->ungetc()
+ $char = $z->opened()
+
+ $data = $z->trailingData()
+ $status = $z->nextStream()
+ $data = $z->getHeaderInfo()
+ $z->tell()
+ $z->seek($position, $whence)
+ $z->binmode()
+ $z->fileno()
+ $z->eof()
+ $z->close()
+
+ $Bunzip2Error ;
+
+ # IO::File mode
+
+ <$z>
+ read($z, $buffer);
+ read($z, $buffer, $length);
+ read($z, $buffer, $length, $offset);
+ tell($z)
+ seek($z, $position, $whence)
+ binmode($z)
+ fileno($z)
+ eof($z)
+ close($z)
+
+=head1 DESCRIPTION
+
+This module provides a Perl interface that allows the reading of
+bzip2 files/buffers.
+
+For writing bzip2 files/buffers, see the companion module IO::Compress::Bzip2.
+
+=head1 Functional Interface
+
+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::Bunzip2 qw(bunzip2 $Bunzip2Error) ;
+
+ bunzip2 $input => $output [,OPTS]
+ or die "bunzip2 failed: $Bunzip2Error\n";
+
+The functional interface needs Perl5.005 or better.
+
+=head2 bunzip2 $input => $output [, OPTS]
+
+C<bunzip2> expects at least two parameters, C<$input> and C<$output>.
+
+=head3 The C<$input> parameter
+
+The parameter, C<$input>, is used to define the source of
+the compressed data.
+
+It can take one of the following forms:
+
+=over 5
+
+=item A filename
+
+If the C<$input> parameter is a simple scalar, it is assumed to be a
+filename. This file will be opened for reading and the input data
+will be read from it.
+
+=item A filehandle
+
+If the C<$input> parameter is a filehandle, the input data will be
+read from it.
+The string '-' can be used as an alias for standard input.
+
+=item A scalar reference
+
+If C<$input> is a scalar reference, the input data will be read
+from C<$$input>.
+
+=item An array reference
+
+If C<$input> is an array reference, each element in the array must be a
+filename.
+
+The input data will be read from each file in turn.
+
+The complete array will be walked to ensure that it only
+contains valid filenames before any data is uncompressed.
+
+=item An Input FileGlob string
+
+If C<$input> is a string that is delimited by the characters "<" and ">"
+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 ...
+
+See L<File::GlobMapper|File::GlobMapper> for more details.
+
+=back
+
+If the C<$input> parameter is any other type, C<undef> will be returned.
+
+=head3 The C<$output> parameter
+
+The parameter C<$output> is used to control the destination of the
+uncompressed data. This parameter can take one of these forms.
+
+=over 5
+
+=item A filename
+
+If the C<$output> parameter is a simple scalar, it is assumed to be a
+filename. This file will be opened for writing and the uncompressed
+data will be written to it.
+
+=item A filehandle
+
+If the C<$output> parameter is a filehandle, the uncompressed data
+will be written to it.
+The string '-' can be used as an alias for standard output.
+
+=item A scalar reference
+
+If C<$output> is a scalar reference, the uncompressed data will be
+stored in C<$$output>.
+
+=item An Array Reference
+
+If C<$output> is an array reference, the uncompressed data will be
+pushed onto the array.
+
+=item An Output FileGlob
+
+If C<$output> is a string that is delimited by the characters "<" and ">"
+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
+string. Anything else is an error.
+
+=back
+
+If the C<$output> parameter is any other type, C<undef> will be returned.
+
+=head2 Notes
+
+When C<$input> maps to multiple compressed files/buffers and C<$output> is
+a single file/buffer, after uncompression C<$output> will contain a
+concatenation of all the uncompressed data from each of the input
+files/buffers.
+
+=head2 Optional Parameters
+
+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.
+
+=over 5
+
+=item C<< AutoClose => 0|1 >>
+
+This option applies to any input or output data streams to
+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<bunzip2> has
+completed.
+
+This parameter defaults to 0.
+
+=item C<< BinModeOut => 0|1 >>
+
+When writing to a file or filehandle, set C<binmode> before writing to the
+file.
+
+Defaults to 0.
+
+=item C<< Append => 0|1 >>
+
+TODO
+
+=item C<< MultiStream => 0|1 >>
+
+If the input file/buffer contains multiple compressed data streams, this
+option will uncompress the whole lot as a single data stream.
+
+Defaults to 0.
+
+=item C<< TrailingData => $scalar >>
+
+Returns the data, if any, that is present immediately after the compressed
+data stream once uncompression is complete.
+
+This option can be used when there is useful information immediately
+following the compressed data stream, and you don't know the length of the
+compressed data stream.
+
+If the input is a buffer, C<trailingData> will return everything from the
+end of the compressed data stream to the end of the buffer.
+
+If the input is a filehandle, C<trailingData> will return the data that is
+left in the filehandle input buffer once the end of the compressed data
+stream has been reached. You can then use the filehandle to read the rest
+of the input file.
+
+Don't bother using C<trailingData> if the input is a filename.
+
+If you know the length of the compressed data stream before you start
+uncompressing, you can avoid having to use C<trailingData> by setting the
+C<InputLength> option.
+
+=back
+
+=head2 Examples
+
+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::Bunzip2 qw(bunzip2 $Bunzip2Error) ;
+
+ my $input = "file1.txt.bz2";
+ my $output = "file1.txt";
+ 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::Bunzip2 qw(bunzip2 $Bunzip2Error) ;
+ use IO::File ;
+
+ my $input = new IO::File "<file1.txt.bz2"
+ or die "Cannot open 'file1.txt.bz2': $!\n" ;
+ my $buffer ;
+ bunzip2 $input => \$buffer
+ or die "bunzip2 failed: $Bunzip2Error\n";
+
+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::Bunzip2 qw(bunzip2 $Bunzip2Error) ;
+
+ 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::Bunzip2 qw(bunzip2 $Bunzip2Error) ;
+
+ for my $input ( glob "/my/home/*.txt.bz2" )
+ {
+ my $output = $input;
+ $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::Bunzip2 is shown below
+
+ my $z = new IO::Uncompress::Bunzip2 $input [OPTS]
+ or die "IO::Uncompress::Bunzip2 failed: $Bunzip2Error\n";
+
+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::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
+
+ $line = $z->getline();
+ $line = <$z>;
+
+The mandatory parameter C<$input> is used to determine the source of the
+compressed data. This parameter can take one of three forms.
+
+=over 5
+
+=item A filename
+
+If the C<$input> parameter is a scalar, it is assumed to be a filename. This
+file will be opened for reading and the compressed data will be read from it.
+
+=item A filehandle
+
+If the C<$input> parameter is a filehandle, the compressed data will be
+read from it.
+The string '-' can be used as an alias for standard input.
+
+=item A scalar reference
+
+If C<$input> is a scalar reference, the compressed data will be read from
+C<$$output>.
+
+=back
+
+=head2 Constructor Options
+
+The option names defined below are case insensitive and can be optionally
+prefixed by a '-'. So all of the following are valid
+
+ -AutoClose
+ -autoclose
+ AUTOCLOSE
+ autoclose
+
+OPTS is a combination of the following options:
+
+=over 5
+
+=item C<< AutoClose => 0|1 >>
+
+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::Bunzip2 object is
+destroyed.
+
+This parameter defaults to 0.
+
+=item C<< MultiStream => 0|1 >>
+
+Allows multiple concatenated compressed streams to be treated as a single
+compressed stream. Decompression will stop once either the end of the
+file/buffer is reached, an error is encountered (premature eof, corrupt
+compressed data) or the end of a stream is not immediately followed by the
+start of another stream.
+
+This parameter defaults to 0.
+
+=item C<< Prime => $string >>
+
+This option will uncompress the contents of C<$string> before processing the
+input file/buffer.
+
+This option can be useful when the compressed data is embedded in another
+file/data structure and it is not possible to work out where the compressed
+data begins without having to read the first few bytes. If this is the
+case, the uncompression can be I<primed> with these bytes using this
+option.
+
+=item C<< Transparent => 0|1 >>
+
+If this option is set and the input file/buffer is not compressed data,
+the module will allow reading of it anyway.
+
+In addition, if the input file/buffer does contain compressed data and
+there is non-compressed data immediately following it, setting this option
+will make this module treat the whole file/bufffer as a single data stream.
+
+This option defaults to 1.
+
+=item C<< BlockSize => $num >>
+
+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<< InputLength => $size >>
+
+When present this option will limit the number of compressed bytes read
+from the input file/buffer to C<$size>. This option can be used in the
+situation where there is useful data directly after the compressed data
+stream and you know beforehand the exact length of the compressed data
+stream.
+
+This option is mostly used when reading from a filehandle, in which case
+the file pointer will be left pointing to the first byte directly after the
+compressed data stream.
+
+This option defaults to off.
+
+=item C<< Append => 0|1 >>
+
+This option controls what the C<read> method does with uncompressed data.
+
+If set to 1, all uncompressed data will be appended to the output parameter
+of the C<read> method.
+
+If set to 0, the contents of the output parameter of the C<read> method
+will be overwritten by the uncompressed data.
+
+Defaults to 0.
+
+=item C<< Strict => 0|1 >>
+
+This option is a no-op.
+
+=item C<< Small => 0|1 >>
+
+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.
+
+Default is 0.
+
+=back
+
+=head2 Examples
+
+TODO
+
+=head1 Methods
+
+=head2 read
+
+Usage is
+
+ $status = $z->read($buffer)
+
+Reads a block of compressed data (the size the the compressed block is
+determined by the C<Buffer> option in the constructor), uncompresses it and
+writes any uncompressed data into C<$buffer>. If the C<Append> parameter is
+set in the constructor, the uncompressed data will be appended to the
+C<$buffer> parameter. Otherwise C<$buffer> will be overwritten.
+
+Returns the number of uncompressed bytes written to C<$buffer>, zero if eof
+or a negative number on error.
+
+=head2 read
+
+Usage is
+
+ $status = $z->read($buffer, $length)
+ $status = $z->read($buffer, $length, $offset)
+
+ $status = read($z, $buffer, $length)
+ $status = read($z, $buffer, $length, $offset)
+
+Attempt to read C<$length> bytes of uncompressed data into C<$buffer>.
+
+The main difference between this form of the C<read> method and the
+previous one, is that this one will attempt to return I<exactly> C<$length>
+bytes. The only circumstances that this function will not is if end-of-file
+or an IO error is encountered.
+
+Returns the number of uncompressed bytes written to C<$buffer>, zero if eof
+or a negative number on error.
+
+=head2 getline
+
+Usage is
+
+ $line = $z->getline()
+ $line = <$z>
+
+Reads a single line.
+
+This method fully supports the use of of the variable C<$/> (or
+C<$INPUT_RECORD_SEPARATOR> or C<$RS> when C<English> is in use) to
+determine what constitutes an end of line. Paragraph mode, record mode and
+file slurp mode are all supported.
+
+=head2 getc
+
+Usage is
+
+ $char = $z->getc()
+
+Read a single character.
+
+=head2 ungetc
+
+Usage is
+
+ $char = $z->ungetc($string)
+
+=head2 getHeaderInfo
+
+Usage is
+
+ $hdr = $z->getHeaderInfo();
+ @hdrs = $z->getHeaderInfo();
+
+This method returns either a hash reference (in scalar context) or a list
+or hash references (in array context) that contains information about each
+of the header fields in the compressed data stream(s).
+
+=head2 tell
+
+Usage is
+
+ $z->tell()
+ tell $z
+
+Returns the uncompressed file offset.
+
+=head2 eof
+
+Usage is
+
+ $z->eof();
+ eof($z);
+
+Returns true if the end of the compressed input stream has been reached.
+
+=head2 seek
+
+ $z->seek($position, $whence);
+ seek($z, $position, $whence);
+
+Provides a sub-set of the C<seek> functionality, with the restriction
+that it is only legal to seek forward in the input file/buffer.
+It is a fatal error to attempt to seek backward.
+
+The C<$whence> parameter takes one the usual values, namely SEEK_SET,
+SEEK_CUR or SEEK_END.
+
+Returns 1 on success, 0 on failure.
+
+=head2 binmode
+
+Usage is
+
+ $z->binmode
+ binmode $z ;
+
+This is a noop provided for completeness.
+
+=head2 opened
+
+ $z->opened()
+
+Returns true if the object currently refers to a opened file/buffer.
+
+=head2 autoflush
+
+ my $prev = $z->autoflush()
+ my $prev = $z->autoflush(EXPR)
+
+If the C<$z> object is associated with a file or a filehandle, this method
+returns the current autoflush setting for the underlying filehandle. If
+C<EXPR> is present, and is non-zero, it will enable flushing after every
+write/print operation.
+
+If C<$z> is associated with a buffer, this method has no effect and always
+returns C<undef>.
+
+B<Note> that the special variable C<$|> B<cannot> be used to set or
+retrieve the autoflush setting.
+
+=head2 input_line_number
+
+ $z->input_line_number()
+ $z->input_line_number(EXPR)
+
+Returns the current uncompressed line number. If C<EXPR> is present it has
+the effect of setting the line number. Note that setting the line number
+does not change the current position within the file/buffer being read.
+
+The contents of C<$/> are used to to determine what constitutes a line
+terminator.
+
+=head2 fileno
+
+ $z->fileno()
+ fileno($z)
+
+If the C<$z> object is associated with a file or a filehandle, C<fileno>
+will return the underlying file descriptor. Once the C<close> method is
+called C<fileno> will return C<undef>.
+
+If the C<$z> object is is associated with a buffer, this method will return
+C<undef>.
+
+=head2 close
+
+ $z->close() ;
+ close $z ;
+
+Closes the output file/buffer.
+
+For most versions of Perl this method will be automatically invoked if
+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
+not until global destruction of all live objects when the program is
+terminating.
+
+Therefore, if you want your scripts to be able to run on all versions
+of Perl, you should call C<close> explicitly and not rely on automatic
+closing.
+
+Returns true on success, otherwise 0.
+
+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.
+
+=head2 nextStream
+
+Usage is
+
+ my $status = $z->nextStream();
+
+Skips to the next compressed data stream in the input file/buffer. If a new
+compressed data stream is found, the eof marker will be cleared and C<$.>
+will be reset to 0.
+
+Returns 1 if a new stream was found, 0 if none was found, and -1 if an
+error was encountered.
+
+=head2 trailingData
+
+Usage is
+
+ my $data = $z->trailingData();
+
+Returns the data, if any, that is present immediately after the compressed
+data stream once uncompression is complete. It only makes sense to call
+this method once the end of the compressed data stream has been
+encountered.
+
+This option can be used when there is useful information immediately
+following the compressed data stream, and you don't know the length of the
+compressed data stream.
+
+If the input is a buffer, C<trailingData> will return everything from the
+end of the compressed data stream to the end of the buffer.
+
+If the input is a filehandle, C<trailingData> will return the data that is
+left in the filehandle input buffer once the end of the compressed data
+stream has been reached. You can then use the filehandle to read the rest
+of the input file.
+
+Don't bother using C<trailingData> if the input is a filename.
+
+If you know the length of the compressed data stream before you start
+uncompressing, you can avoid having to use C<trailingData> by setting the
+C<InputLength> option in the constructor.
+
+=head1 Importing
+
+No symbolic constants are required by this IO::Uncompress::Bunzip2 at present.
+
+=over 5
+
+=item :all
+
+Imports C<bunzip2> and C<$Bunzip2Error>.
+Same as doing this
+
+ use IO::Uncompress::Bunzip2 qw(bunzip2 $Bunzip2Error) ;
+
+=back
+
+=head1 EXAMPLES
+
+=head2 Working with 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::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<File::GlobMapper|File::GlobMapper>, L<Archive::Zip|Archive::Zip>,
+L<Archive::Tar|Archive::Tar>,
+L<IO::Zlib|IO::Zlib>
+
+The primary site for the bzip2 program is F<http://www.bzip.org>.
+
+See the module L<Compress::Bzip2|Compress::Bzip2>
+
+=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.
+
diff --git a/ext/IO_Compress_Zlib/lib/IO/Uncompress/Gunzip.pm b/ext/IO-Compress/lib/IO/Uncompress/Gunzip.pm
index 72dd5cff49..6f738cf9e6 100644
--- a/ext/IO_Compress_Zlib/lib/IO/Uncompress/Gunzip.pm
+++ b/ext/IO-Compress/lib/IO/Uncompress/Gunzip.pm
@@ -9,12 +9,12 @@ use strict ;
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 ;
@@ -28,7 +28,7 @@ Exporter::export_ok_tags('all');
$GunzipError = '';
-$VERSION = '2.015';
+$VERSION = '2.017';
sub new
{
@@ -47,7 +47,7 @@ sub gunzip
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] ) ;
}
@@ -1063,7 +1063,7 @@ See the Changes file.
=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.
diff --git a/ext/IO_Compress_Zlib/lib/IO/Uncompress/Inflate.pm b/ext/IO-Compress/lib/IO/Uncompress/Inflate.pm
index 23fe2db209..21e9ec47b4 100644
--- a/ext/IO_Compress_Zlib/lib/IO/Uncompress/Inflate.pm
+++ b/ext/IO-Compress/lib/IO/Uncompress/Inflate.pm
@@ -5,15 +5,15 @@ 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.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 );
@@ -934,7 +934,7 @@ See the Changes file.
=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.
diff --git a/ext/IO_Compress_Zlib/lib/IO/Uncompress/RawInflate.pm b/ext/IO-Compress/lib/IO/Uncompress/RawInflate.pm
index def05a885f..2c9f9b770c 100644..100755
--- a/ext/IO_Compress_Zlib/lib/IO/Uncompress/RawInflate.pm
+++ b/ext/IO-Compress/lib/IO/Uncompress/RawInflate.pm
@@ -5,19 +5,16 @@ use strict ;
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 );
@@ -27,7 +24,23 @@ $RawInflateError = '';
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
{
@@ -142,9 +155,15 @@ sub _isRawx
*$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;
@@ -153,11 +172,9 @@ sub _isRawx
&& (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 ;
@@ -1045,7 +1062,7 @@ See the Changes file.
=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.
diff --git a/ext/IO_Compress_Zlib/lib/IO/Uncompress/Unzip.pm b/ext/IO-Compress/lib/IO/Uncompress/Unzip.pm
index 6ba7644520..08f94db6bc 100644
--- a/ext/IO_Compress_Zlib/lib/IO/Uncompress/Unzip.pm
+++ b/ext/IO-Compress/lib/IO/Uncompress/Unzip.pm
@@ -8,19 +8,21 @@ use strict ;
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 } ;
}
@@ -28,7 +30,7 @@ require Exporter ;
our ($VERSION, @ISA, @EXPORT_OK, %EXPORT_TAGS, $UnzipError, %headerLookup);
-$VERSION = '2.015';
+$VERSION = '2.017';
$UnzipError = '';
@ISA = qw(Exporter IO::Uncompress::RawInflate);
@@ -61,7 +63,7 @@ sub unzip
sub getExtraParams
{
- use IO::Compress::Base::Common 2.015 qw(:Parse);
+ use IO::Compress::Base::Common 2.017 qw(:Parse);
return (
@@ -617,6 +619,18 @@ sub _readZipHeader($)
*$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
@@ -1408,43 +1422,6 @@ Same as doing this
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>
@@ -1478,7 +1455,7 @@ See the Changes file.
=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.
diff --git a/ext/IO_Compress_Zlib/pod/FAQ.pod b/ext/IO-Compress/pod/FAQ.pod
index 31fd24f8b2..0fee2a9f6d 100644
--- a/ext/IO_Compress_Zlib/pod/FAQ.pod
+++ b/ext/IO-Compress/pod/FAQ.pod
@@ -1,7 +1,7 @@
=head1 NAME
-IO::Compress::Zlib::FAQ -- Frequently Asked Questions about IO::Compress::Zlib
+IO::Compress::FAQ -- Frequently Asked Questions about IO::Compress
=head1 DESCRIPTION
@@ -9,7 +9,10 @@ Common questions answered.
=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
@@ -37,11 +40,14 @@ available
=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>
@@ -499,7 +505,7 @@ See the Changes file.
=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.
diff --git a/ext/Compress-Zlib/private/MakeUtil.pm b/ext/IO-Compress/private/MakeUtil.pm
index e595910654..e595910654 100644
--- a/ext/Compress-Zlib/private/MakeUtil.pm
+++ b/ext/IO-Compress/private/MakeUtil.pm
diff --git a/ext/IO-Compress/t/000prereq.t b/ext/IO-Compress/t/000prereq.t
new file mode 100644
index 0000000000..3ac318fe56
--- /dev/null
+++ b/ext/IO-Compress/t/000prereq.t
@@ -0,0 +1,56 @@
+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" ;
+ }
+ }
+
+}
+
diff --git a/ext/IO-Compress/t/001bzip2.t b/ext/IO-Compress/t/001bzip2.t
new file mode 100644
index 0000000000..40b9bcca59
--- /dev/null
+++ b/ext/IO-Compress/t/001bzip2.t
@@ -0,0 +1,206 @@
+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;
+
+
+
+
diff --git a/ext/IO_Compress_Zlib/t/001zlib-generic-deflate.t b/ext/IO-Compress/t/001zlib-generic-deflate.t
index a988ab9791..a988ab9791 100644
--- a/ext/IO_Compress_Zlib/t/001zlib-generic-deflate.t
+++ b/ext/IO-Compress/t/001zlib-generic-deflate.t
diff --git a/ext/IO_Compress_Zlib/t/001zlib-generic-gzip.t b/ext/IO-Compress/t/001zlib-generic-gzip.t
index db9101d91f..db9101d91f 100644
--- a/ext/IO_Compress_Zlib/t/001zlib-generic-gzip.t
+++ b/ext/IO-Compress/t/001zlib-generic-gzip.t
diff --git a/ext/IO_Compress_Zlib/t/001zlib-generic-rawdeflate.t b/ext/IO-Compress/t/001zlib-generic-rawdeflate.t
index 4c491eb3a2..4c491eb3a2 100644
--- a/ext/IO_Compress_Zlib/t/001zlib-generic-rawdeflate.t
+++ b/ext/IO-Compress/t/001zlib-generic-rawdeflate.t
diff --git a/ext/IO_Compress_Zlib/t/001zlib-generic-zip.t b/ext/IO-Compress/t/001zlib-generic-zip.t
index a9c755537f..a9c755537f 100644
--- a/ext/IO_Compress_Zlib/t/001zlib-generic-zip.t
+++ b/ext/IO-Compress/t/001zlib-generic-zip.t
diff --git a/ext/IO_Compress_Zlib/t/002any-deflate.t b/ext/IO-Compress/t/002any-deflate.t
index 6a4387ef0c..6a4387ef0c 100644
--- a/ext/IO_Compress_Zlib/t/002any-deflate.t
+++ b/ext/IO-Compress/t/002any-deflate.t
diff --git a/ext/IO_Compress_Zlib/t/002any-gzip.t b/ext/IO-Compress/t/002any-gzip.t
index e93625fdfa..e93625fdfa 100644
--- a/ext/IO_Compress_Zlib/t/002any-gzip.t
+++ b/ext/IO-Compress/t/002any-gzip.t
diff --git a/ext/IO_Compress_Zlib/t/002any-rawdeflate.t b/ext/IO-Compress/t/002any-rawdeflate.t
index ef716c60c1..ef716c60c1 100644
--- a/ext/IO_Compress_Zlib/t/002any-rawdeflate.t
+++ b/ext/IO-Compress/t/002any-rawdeflate.t
diff --git a/ext/IO_Compress_Zlib/t/002any-transparent.t b/ext/IO-Compress/t/002any-transparent.t
index bb26bbcac0..bb26bbcac0 100644
--- a/ext/IO_Compress_Zlib/t/002any-transparent.t
+++ b/ext/IO-Compress/t/002any-transparent.t
diff --git a/ext/IO_Compress_Zlib/t/002any-zip.t b/ext/IO-Compress/t/002any-zip.t
index 27f1714899..27f1714899 100644
--- a/ext/IO_Compress_Zlib/t/002any-zip.t
+++ b/ext/IO-Compress/t/002any-zip.t
diff --git a/ext/IO_Compress_Zlib/t/004gziphdr.t b/ext/IO-Compress/t/004gziphdr.t
index 210d499a65..210d499a65 100644
--- a/ext/IO_Compress_Zlib/t/004gziphdr.t
+++ b/ext/IO-Compress/t/004gziphdr.t
diff --git a/ext/IO_Compress_Zlib/t/005defhdr.t b/ext/IO-Compress/t/005defhdr.t
index 990b79b3f1..990b79b3f1 100644
--- a/ext/IO_Compress_Zlib/t/005defhdr.t
+++ b/ext/IO-Compress/t/005defhdr.t
diff --git a/ext/IO_Compress_Zlib/t/006zip.t b/ext/IO-Compress/t/006zip.t
index fdb28ee97e..fdb28ee97e 100644
--- a/ext/IO_Compress_Zlib/t/006zip.t
+++ b/ext/IO-Compress/t/006zip.t
diff --git a/ext/IO-Compress/t/010examples-bzip2.t b/ext/IO-Compress/t/010examples-bzip2.t
new file mode 100644
index 0000000000..9bb5eb20e7
--- /dev/null
+++ b/ext/IO-Compress/t/010examples-bzip2.t
@@ -0,0 +1,145 @@
+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 IO::Compress::Bzip2 'bzip2' ;
+
+BEGIN
+{
+ plan(skip_all => "Examples needs Perl 5.005 or better - you have Perl $]" )
+ if $] < 5.005 ;
+
+ # use Test::NoWarnings, if available
+ my $extra = 0 ;
+ $extra = 1
+ if eval { require Test::NoWarnings ; import Test::NoWarnings; 1 };
+
+ plan tests => 19 + $extra ;
+}
+
+
+my $Inc = join " ", map qq["-I$_"] => @INC;
+$Inc = '"-MExtUtils::testlib"'
+ if ! $ENV{PERL_CORE} && eval " require ExtUtils::testlib; " ;
+
+my $Perl = ($ENV{'FULLPERL'} or $^X or 'perl') ;
+$Perl = qq["$Perl"] if $^O eq 'MSWin32' ;
+
+$Perl = "$Perl $Inc -w" ;
+#$Perl .= " -Mblib " ;
+my $examples = $ENV{PERL_CORE} ? "../ext/IO-Compress/examples/io/bzip2"
+ : "./examples/io/bzip2";
+
+my $hello1 = <<EOM ;
+hello
+this is
+a test
+message
+x ttttt
+xuuuuuu
+the end
+EOM
+
+my @hello1 = grep(s/$/\n/, split(/\n/, $hello1)) ;
+
+my $hello2 = <<EOM;
+
+Howdy
+this is the
+second
+file
+x ppppp
+xuuuuuu
+really the end
+EOM
+
+my @hello2 = grep(s/$/\n/, split(/\n/, $hello2)) ;
+
+my $file1 = "hello1.gz" ;
+my $file2 = "hello2.gz" ;
+my $stderr = "err.out" ;
+
+for ($file1, $file2, $stderr) { 1 while unlink $_ } ;
+
+
+bzip2 \$hello1 => $file1 ;
+bzip2 \$hello2 => $file2 ;
+
+sub check
+{
+ my $command = shift ;
+ my $expected = shift ;
+
+ my $stderr = 'err.out';
+ 1 while unlink $stderr;
+
+ my $cmd = "$command 2>$stderr";
+ my $stdout = `$cmd` ;
+
+ my $aok = 1 ;
+
+ $aok &= is $?, 0, " exit status is 0" ;
+
+ $aok &= is readFile($stderr), '', " no stderr" ;
+
+ $aok &= is $stdout, $expected, " expected content is ok"
+ if defined $expected ;
+
+ if (! $aok) {
+ diag "Command line: $cmd";
+ my ($file, $line) = (caller)[1,2];
+ diag "Test called from $file, line $line";
+ }
+
+ 1 while unlink $stderr;
+}
+
+# bzcat
+# #####
+
+title "bzcat - command line" ;
+check "$Perl ${examples}/bzcat $file1 $file2", $hello1 . $hello2;
+
+title "bzcat - stdin" ;
+check "$Perl ${examples}/bzcat <$file1 ", $hello1;
+
+
+# bzgrep
+# ######
+
+title "bzgrep";
+check "$Perl ${examples}/bzgrep the $file1 $file2",
+ join('', grep(/the/, @hello1, @hello2));
+
+for ($file1, $file2, $stderr) { 1 while unlink $_ } ;
+
+
+
+# bzstream
+# ########
+
+{
+ title "bzstream" ;
+ writeFile($file1, $hello1) ;
+ check "$Perl ${examples}/bzstream <$file1 >$file2";
+
+ title "bzcat" ;
+ check "$Perl ${examples}/bzcat $file2", $hello1 ;
+}
+
+END
+{
+ for ($file1, $file2, $stderr) { 1 while unlink $_ } ;
+}
+
diff --git a/ext/IO_Compress_Zlib/t/010examples.t b/ext/IO-Compress/t/010examples-zlib.t
index a2562a2a0f..712c0b4934 100644
--- a/ext/IO_Compress_Zlib/t/010examples.t
+++ b/ext/IO-Compress/t/010examples-zlib.t
@@ -38,8 +38,8 @@ $Perl = qq["$Perl"] if $^O eq 'MSWin32' ;
$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
diff --git a/ext/IO_Compress_Base/t/01misc.t b/ext/IO-Compress/t/01misc.t
index 27706f6cfa..27706f6cfa 100644
--- a/ext/IO_Compress_Base/t/01misc.t
+++ b/ext/IO-Compress/t/01misc.t
diff --git a/ext/IO_Compress_Zlib/t/020isize.t b/ext/IO-Compress/t/020isize.t
index c600c95f34..c600c95f34 100644
--- a/ext/IO_Compress_Zlib/t/020isize.t
+++ b/ext/IO-Compress/t/020isize.t
diff --git a/ext/IO_Compress_Zlib/t/050interop-gzip.t b/ext/IO-Compress/t/050interop-gzip.t
index 22be0646c8..22be0646c8 100644
--- a/ext/IO_Compress_Zlib/t/050interop-gzip.t
+++ b/ext/IO-Compress/t/050interop-gzip.t
diff --git a/ext/IO-Compress/t/100generic-bzip2.t b/ext/IO-Compress/t/100generic-bzip2.t
new file mode 100644
index 0000000000..a9f430e236
--- /dev/null
+++ b/ext/IO-Compress/t/100generic-bzip2.t
@@ -0,0 +1,21 @@
+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 IO::Compress::Bzip2 qw($Bzip2Error) ;
+use IO::Uncompress::Bunzip2 qw($Bunzip2Error) ;
+
+sub identify
+{
+ 'IO::Compress::Bzip2';
+}
+
+require "generic.pl" ;
+run();
diff --git a/ext/IO_Compress_Zlib/t/100generic-deflate.t b/ext/IO-Compress/t/100generic-deflate.t
index 999c9561e2..999c9561e2 100644
--- a/ext/IO_Compress_Zlib/t/100generic-deflate.t
+++ b/ext/IO-Compress/t/100generic-deflate.t
diff --git a/ext/IO_Compress_Zlib/t/100generic-gzip.t b/ext/IO-Compress/t/100generic-gzip.t
index 614945ca80..614945ca80 100644
--- a/ext/IO_Compress_Zlib/t/100generic-gzip.t
+++ b/ext/IO-Compress/t/100generic-gzip.t
diff --git a/ext/IO_Compress_Zlib/t/100generic-rawdeflate.t b/ext/IO-Compress/t/100generic-rawdeflate.t
index b5a43697bd..b5a43697bd 100644
--- a/ext/IO_Compress_Zlib/t/100generic-rawdeflate.t
+++ b/ext/IO-Compress/t/100generic-rawdeflate.t
diff --git a/ext/IO_Compress_Zlib/t/100generic-zip.t b/ext/IO-Compress/t/100generic-zip.t
index 907dada4c5..907dada4c5 100644
--- a/ext/IO_Compress_Zlib/t/100generic-zip.t
+++ b/ext/IO-Compress/t/100generic-zip.t
diff --git a/ext/IO-Compress/t/101truncate-bzip2.t b/ext/IO-Compress/t/101truncate-bzip2.t
new file mode 100644
index 0000000000..7aba01dd39
--- /dev/null
+++ b/ext/IO-Compress/t/101truncate-bzip2.t
@@ -0,0 +1,37 @@
+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 };
+
+ plan tests => 912 + $extra;
+
+};
+
+
+#use Test::More skip_all => "not implemented yet";
+
+
+use IO::Compress::Bzip2 qw($Bzip2Error) ;
+use IO::Uncompress::Bunzip2 qw($Bunzip2Error) ;
+
+sub identify
+{
+ 'IO::Compress::Bzip2';
+}
+
+require "truncate.pl" ;
+run();
diff --git a/ext/IO_Compress_Zlib/t/101truncate-deflate.t b/ext/IO-Compress/t/101truncate-deflate.t
index 2ae2b312df..2ae2b312df 100644
--- a/ext/IO_Compress_Zlib/t/101truncate-deflate.t
+++ b/ext/IO-Compress/t/101truncate-deflate.t
diff --git a/ext/IO_Compress_Zlib/t/101truncate-gzip.t b/ext/IO-Compress/t/101truncate-gzip.t
index 1e546b47e9..1e546b47e9 100644
--- a/ext/IO_Compress_Zlib/t/101truncate-gzip.t
+++ b/ext/IO-Compress/t/101truncate-gzip.t
diff --git a/ext/IO_Compress_Zlib/t/101truncate-rawdeflate.t b/ext/IO-Compress/t/101truncate-rawdeflate.t
index cc4a2a3e2f..d81b54a7b3 100644
--- a/ext/IO_Compress_Zlib/t/101truncate-rawdeflate.t
+++ b/ext/IO-Compress/t/101truncate-rawdeflate.t
@@ -63,9 +63,9 @@ foreach my $CompressClass ( 'IO::Compress::RawDeflate')
-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)
{
@@ -95,7 +95,7 @@ foreach my $CompressClass ( 'IO::Compress::RawDeflate')
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();
diff --git a/ext/IO_Compress_Zlib/t/101truncate-zip.t b/ext/IO-Compress/t/101truncate-zip.t
index 719da361ed..719da361ed 100644
--- a/ext/IO_Compress_Zlib/t/101truncate-zip.t
+++ b/ext/IO-Compress/t/101truncate-zip.t
diff --git a/ext/IO-Compress/t/102tied-bzip2.t b/ext/IO-Compress/t/102tied-bzip2.t
new file mode 100644
index 0000000000..8503e02529
--- /dev/null
+++ b/ext/IO-Compress/t/102tied-bzip2.t
@@ -0,0 +1,21 @@
+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 IO::Compress::Bzip2 qw($Bzip2Error) ;
+use IO::Uncompress::Bunzip2 qw($Bunzip2Error) ;
+
+sub identify
+{
+ 'IO::Compress::Bzip2';
+}
+
+require "tied.pl" ;
+run();
diff --git a/ext/IO_Compress_Zlib/t/102tied-deflate.t b/ext/IO-Compress/t/102tied-deflate.t
index 8747aee90f..8747aee90f 100644
--- a/ext/IO_Compress_Zlib/t/102tied-deflate.t
+++ b/ext/IO-Compress/t/102tied-deflate.t
diff --git a/ext/IO_Compress_Zlib/t/102tied-gzip.t b/ext/IO-Compress/t/102tied-gzip.t
index 52a502ecd3..52a502ecd3 100644
--- a/ext/IO_Compress_Zlib/t/102tied-gzip.t
+++ b/ext/IO-Compress/t/102tied-gzip.t
diff --git a/ext/IO_Compress_Zlib/t/102tied-rawdeflate.t b/ext/IO-Compress/t/102tied-rawdeflate.t
index f3ba80cfc8..f3ba80cfc8 100644
--- a/ext/IO_Compress_Zlib/t/102tied-rawdeflate.t
+++ b/ext/IO-Compress/t/102tied-rawdeflate.t
diff --git a/ext/IO_Compress_Zlib/t/102tied-zip.t b/ext/IO-Compress/t/102tied-zip.t
index 04be98dc6f..04be98dc6f 100644
--- a/ext/IO_Compress_Zlib/t/102tied-zip.t
+++ b/ext/IO-Compress/t/102tied-zip.t
diff --git a/ext/IO-Compress/t/103newtied-bzip2.t b/ext/IO-Compress/t/103newtied-bzip2.t
new file mode 100644
index 0000000000..ecf8a49893
--- /dev/null
+++ b/ext/IO-Compress/t/103newtied-bzip2.t
@@ -0,0 +1,21 @@
+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 IO::Compress::Bzip2 qw($Bzip2Error) ;
+use IO::Uncompress::Bunzip2 qw($Bunzip2Error) ;
+
+sub identify
+{
+ 'IO::Compress::Bzip2';
+}
+
+require "newtied.pl" ;
+run();
diff --git a/ext/IO_Compress_Zlib/t/103newtied-deflate.t b/ext/IO-Compress/t/103newtied-deflate.t
index 42a3d3c2bd..42a3d3c2bd 100644
--- a/ext/IO_Compress_Zlib/t/103newtied-deflate.t
+++ b/ext/IO-Compress/t/103newtied-deflate.t
diff --git a/ext/IO_Compress_Zlib/t/103newtied-gzip.t b/ext/IO-Compress/t/103newtied-gzip.t
index 7a453fa479..7a453fa479 100644
--- a/ext/IO_Compress_Zlib/t/103newtied-gzip.t
+++ b/ext/IO-Compress/t/103newtied-gzip.t
diff --git a/ext/IO_Compress_Zlib/t/103newtied-rawdeflate.t b/ext/IO-Compress/t/103newtied-rawdeflate.t
index 93a5118526..93a5118526 100644
--- a/ext/IO_Compress_Zlib/t/103newtied-rawdeflate.t
+++ b/ext/IO-Compress/t/103newtied-rawdeflate.t
diff --git a/ext/IO_Compress_Zlib/t/103newtied-zip.t b/ext/IO-Compress/t/103newtied-zip.t
index 84b19453b7..84b19453b7 100644
--- a/ext/IO_Compress_Zlib/t/103newtied-zip.t
+++ b/ext/IO-Compress/t/103newtied-zip.t
diff --git a/ext/IO-Compress/t/104destroy-bzip2.t b/ext/IO-Compress/t/104destroy-bzip2.t
new file mode 100644
index 0000000000..e8c02cf3d2
--- /dev/null
+++ b/ext/IO-Compress/t/104destroy-bzip2.t
@@ -0,0 +1,21 @@
+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 IO::Compress::Bzip2 qw($Bzip2Error) ;
+use IO::Uncompress::Bunzip2 qw($Bunzip2Error) ;
+
+sub identify
+{
+ 'IO::Compress::Bzip2';
+}
+
+require "destroy.pl" ;
+run();
diff --git a/ext/IO_Compress_Zlib/t/104destroy-deflate.t b/ext/IO-Compress/t/104destroy-deflate.t
index 37511f7df4..37511f7df4 100644
--- a/ext/IO_Compress_Zlib/t/104destroy-deflate.t
+++ b/ext/IO-Compress/t/104destroy-deflate.t
diff --git a/ext/IO_Compress_Zlib/t/104destroy-gzip.t b/ext/IO-Compress/t/104destroy-gzip.t
index 5f686f480c..5f686f480c 100644
--- a/ext/IO_Compress_Zlib/t/104destroy-gzip.t
+++ b/ext/IO-Compress/t/104destroy-gzip.t
diff --git a/ext/IO_Compress_Zlib/t/104destroy-rawdeflate.t b/ext/IO-Compress/t/104destroy-rawdeflate.t
index 1463000e23..1463000e23 100644
--- a/ext/IO_Compress_Zlib/t/104destroy-rawdeflate.t
+++ b/ext/IO-Compress/t/104destroy-rawdeflate.t
diff --git a/ext/IO_Compress_Zlib/t/104destroy-zip.t b/ext/IO-Compress/t/104destroy-zip.t
index d071a06d37..d071a06d37 100644
--- a/ext/IO_Compress_Zlib/t/104destroy-zip.t
+++ b/ext/IO-Compress/t/104destroy-zip.t
diff --git a/ext/IO-Compress/t/105oneshot-bzip2.t b/ext/IO-Compress/t/105oneshot-bzip2.t
new file mode 100644
index 0000000000..c402829fe4
--- /dev/null
+++ b/ext/IO-Compress/t/105oneshot-bzip2.t
@@ -0,0 +1,22 @@
+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 IO::Compress::Bzip2 qw($Bzip2Error) ;
+use IO::Uncompress::Bunzip2 qw($Bunzip2Error) ;
+
+sub identify
+{
+ 'IO::Compress::Bzip2';
+}
+
+require "oneshot.pl" ;
+
+run();
diff --git a/ext/IO_Compress_Zlib/t/105oneshot-deflate.t b/ext/IO-Compress/t/105oneshot-deflate.t
index ab108eaa78..ab108eaa78 100644
--- a/ext/IO_Compress_Zlib/t/105oneshot-deflate.t
+++ b/ext/IO-Compress/t/105oneshot-deflate.t
diff --git a/ext/IO_Compress_Zlib/t/105oneshot-gzip-only.t b/ext/IO-Compress/t/105oneshot-gzip-only.t
index 0382df8e33..0382df8e33 100644
--- a/ext/IO_Compress_Zlib/t/105oneshot-gzip-only.t
+++ b/ext/IO-Compress/t/105oneshot-gzip-only.t
diff --git a/ext/IO_Compress_Zlib/t/105oneshot-gzip.t b/ext/IO-Compress/t/105oneshot-gzip.t
index 2aab93e67c..9a45222dc1 100644
--- a/ext/IO_Compress_Zlib/t/105oneshot-gzip.t
+++ b/ext/IO-Compress/t/105oneshot-gzip.t
@@ -18,4 +18,5 @@ sub identify
}
require "oneshot.pl" ;
+
run();
diff --git a/ext/IO_Compress_Zlib/t/105oneshot-rawdeflate.t b/ext/IO-Compress/t/105oneshot-rawdeflate.t
index 50cb80a3c1..50cb80a3c1 100644
--- a/ext/IO_Compress_Zlib/t/105oneshot-rawdeflate.t
+++ b/ext/IO-Compress/t/105oneshot-rawdeflate.t
diff --git a/ext/IO-Compress/t/105oneshot-zip-bzip2-only.t b/ext/IO-Compress/t/105oneshot-zip-bzip2-only.t
new file mode 100644
index 0000000000..861eaef8fd
--- /dev/null
+++ b/ext/IO-Compress/t/105oneshot-zip-bzip2-only.t
@@ -0,0 +1,168 @@
+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 {
+ 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 => 120 + $extra ;
+
+ #use_ok('IO::Compress::Zip', qw(zip $ZipError :zip_method)) ;
+ use_ok('IO::Compress::Zip', qw(:all)) ;
+ use_ok('IO::Uncompress::Unzip', qw(unzip $UnzipError)) ;
+
+
+}
+
+
+sub zipGetHeader
+{
+ my $in = shift;
+ my $content = shift ;
+ my %opts = @_ ;
+
+ my $out ;
+ my $got ;
+
+ ok zip($in, \$out, %opts), " zip ok" ;
+ ok unzip(\$out, \$got), " unzip ok"
+ or diag $UnzipError ;
+ is $got, $content, " got expected content" ;
+
+ my $gunz = new IO::Uncompress::Unzip \$out, Strict => 0
+ or diag "UnzipError is $IO::Uncompress::Unzip::UnzipError" ;
+ ok $gunz, " Created IO::Uncompress::Unzip object";
+ my $hdr = $gunz->getHeaderInfo();
+ ok $hdr, " got Header info";
+ my $uncomp ;
+ ok $gunz->read($uncomp), " read ok" ;
+ is $uncomp, $content, " got expected content";
+ ok $gunz->close, " closed ok" ;
+
+ return $hdr ;
+
+}
+
+
+for my $stream (0, 1)
+{
+ for my $zip64 (0, 1)
+ {
+ next if $zip64 && ! $stream;
+
+ 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);
+
+ ok zip(\$content => $file1 , Method => $method,
+ Zip64 => $zip64,
+ Stream => $stream), " zip ok"
+ or diag $ZipError ;
+
+ my $got ;
+ if ($stream && $method == ZIP_CM_STORE ) {
+ #eval ' unzip($file1 => \$got) ';
+ ok ! unzip($file1 => \$got), " unzip fails";
+ like $UnzipError, "/Streamed Stored content not supported/",
+ " Streamed Stored content not supported";
+ next ;
+ }
+
+ ok unzip($file1 => \$got), " unzip ok"
+ or diag $UnzipError ;
+
+ is $got, $content, " content ok";
+
+ my $u = new IO::Uncompress::Unzip $file1
+ or diag $ZipError ;
+
+ my $hdr = $u->getHeaderInfo();
+ ok $hdr, " got header";
+
+ is $hdr->{Stream}, $stream, " stream is $stream" ;
+ is $hdr->{MethodID}, $method, " MethodID is $method" ;
+ is $hdr->{Zip64}, $zip64, " Zip64 is $zip64" ;
+ }
+ }
+}
+
+for my $stream (0, 1)
+{
+ for my $zip64 (0, 1)
+ {
+ next if $zip64 && ! $stream;
+
+ for my $method (ZIP_CM_STORE, ZIP_CM_DEFLATE, ZIP_CM_BZIP2)
+ {
+ title "Stream $stream, Zip64 $zip64, Method $method";
+
+ my $file1;
+ my $file2;
+ my $zipfile;
+ my $lex = new LexFile $file1, $file2, $zipfile;
+
+ my $content1 = "hello ";
+ writeFile($file1, $content1);
+
+ my $content2 = "goodbye ";
+ writeFile($file2, $content2);
+
+ my %content = ( $file1 => $content1,
+ $file2 => $content2,
+ );
+
+ ok zip([$file1, $file2] => $zipfile , Method => $method,
+ Zip64 => $zip64,
+ Stream => $stream), " zip ok"
+ or diag $ZipError ;
+
+ for my $file ($file1, $file2)
+ {
+ my $got ;
+ if ($stream && $method == ZIP_CM_STORE ) {
+ #eval ' unzip($zipfile => \$got) ';
+ ok ! unzip($zipfile => \$got, Name => $file), " unzip fails";
+ like $UnzipError, "/Streamed Stored content not supported/",
+ " Streamed Stored content not supported";
+ next ;
+ }
+
+ ok unzip($zipfile => \$got, Name => $file), " unzip $file ok"
+ or diag $UnzipError ;
+
+ is $got, $content{$file}, " content ok";
+ }
+ }
+ }
+}
+
+# TODO add more error cases
+
diff --git a/ext/IO_Compress_Zlib/t/105oneshot-zip-only.t b/ext/IO-Compress/t/105oneshot-zip-only.t
index 807c9e9d61..807c9e9d61 100644
--- a/ext/IO_Compress_Zlib/t/105oneshot-zip-only.t
+++ b/ext/IO-Compress/t/105oneshot-zip-only.t
diff --git a/ext/IO_Compress_Zlib/t/105oneshot-zip.t b/ext/IO-Compress/t/105oneshot-zip.t
index e236fc66fa..e236fc66fa 100644
--- a/ext/IO_Compress_Zlib/t/105oneshot-zip.t
+++ b/ext/IO-Compress/t/105oneshot-zip.t
diff --git a/ext/IO-Compress/t/106prime-bzip2.t b/ext/IO-Compress/t/106prime-bzip2.t
new file mode 100644
index 0000000000..d5a0d98fff
--- /dev/null
+++ b/ext/IO-Compress/t/106prime-bzip2.t
@@ -0,0 +1,21 @@
+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 IO::Compress::Bzip2 qw($Bzip2Error) ;
+use IO::Uncompress::Bunzip2 qw($Bunzip2Error) ;
+
+sub identify
+{
+ 'IO::Compress::Bzip2';
+}
+
+require "prime.pl" ;
+run();
diff --git a/ext/IO_Compress_Zlib/t/106prime-deflate.t b/ext/IO-Compress/t/106prime-deflate.t
index 0ef9bd8834..0ef9bd8834 100644
--- a/ext/IO_Compress_Zlib/t/106prime-deflate.t
+++ b/ext/IO-Compress/t/106prime-deflate.t
diff --git a/ext/IO_Compress_Zlib/t/106prime-gzip.t b/ext/IO-Compress/t/106prime-gzip.t
index b6ab10e6d2..b6ab10e6d2 100644
--- a/ext/IO_Compress_Zlib/t/106prime-gzip.t
+++ b/ext/IO-Compress/t/106prime-gzip.t
diff --git a/ext/IO_Compress_Zlib/t/106prime-rawdeflate.t b/ext/IO-Compress/t/106prime-rawdeflate.t
index 4c81f7c605..4c81f7c605 100644
--- a/ext/IO_Compress_Zlib/t/106prime-rawdeflate.t
+++ b/ext/IO-Compress/t/106prime-rawdeflate.t
diff --git a/ext/IO_Compress_Zlib/t/106prime-zip.t b/ext/IO-Compress/t/106prime-zip.t
index 702c40128a..702c40128a 100644
--- a/ext/IO_Compress_Zlib/t/106prime-zip.t
+++ b/ext/IO-Compress/t/106prime-zip.t
diff --git a/ext/IO-Compress/t/107multi-bzip2.t b/ext/IO-Compress/t/107multi-bzip2.t
new file mode 100644
index 0000000000..0e7f5dbef3
--- /dev/null
+++ b/ext/IO-Compress/t/107multi-bzip2.t
@@ -0,0 +1,21 @@
+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 IO::Compress::Bzip2 qw($Bzip2Error) ;
+use IO::Uncompress::Bunzip2 qw($Bunzip2Error) ;
+
+sub identify
+{
+ 'IO::Compress::Bzip2';
+}
+
+require "multi.pl" ;
+run();
diff --git a/ext/IO_Compress_Zlib/t/107multi-deflate.t b/ext/IO-Compress/t/107multi-deflate.t
index 397869bc92..397869bc92 100644
--- a/ext/IO_Compress_Zlib/t/107multi-deflate.t
+++ b/ext/IO-Compress/t/107multi-deflate.t
diff --git a/ext/IO_Compress_Zlib/t/107multi-gzip.t b/ext/IO-Compress/t/107multi-gzip.t
index 10922ed0da..10922ed0da 100644
--- a/ext/IO_Compress_Zlib/t/107multi-gzip.t
+++ b/ext/IO-Compress/t/107multi-gzip.t
diff --git a/ext/IO_Compress_Zlib/t/107multi-rawdeflate.t b/ext/IO-Compress/t/107multi-rawdeflate.t
index 374cb67831..374cb67831 100644
--- a/ext/IO_Compress_Zlib/t/107multi-rawdeflate.t
+++ b/ext/IO-Compress/t/107multi-rawdeflate.t
diff --git a/ext/IO_Compress_Zlib/t/107multi-zip.t b/ext/IO-Compress/t/107multi-zip.t
index fea653fbf6..fea653fbf6 100644
--- a/ext/IO_Compress_Zlib/t/107multi-zip.t
+++ b/ext/IO-Compress/t/107multi-zip.t
diff --git a/ext/IO-Compress/t/108anyunc-bzip2.t b/ext/IO-Compress/t/108anyunc-bzip2.t
new file mode 100644
index 0000000000..4b981e6806
--- /dev/null
+++ b/ext/IO-Compress/t/108anyunc-bzip2.t
@@ -0,0 +1,29 @@
+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 IO::Uncompress::AnyUncompress qw($AnyUncompressError) ;
+
+use IO::Compress::Bzip2 qw($Bzip2Error) ;
+use IO::Uncompress::Bunzip2 qw($Bunzip2Error) ;
+
+sub getClass
+{
+ 'AnyUncompress';
+}
+
+
+sub identify
+{
+ 'IO::Compress::Bzip2';
+}
+
+require "any.pl" ;
+run();
diff --git a/ext/IO_Compress_Zlib/t/108anyunc-deflate.t b/ext/IO-Compress/t/108anyunc-deflate.t
index ed5e6b5efe..ed5e6b5efe 100644
--- a/ext/IO_Compress_Zlib/t/108anyunc-deflate.t
+++ b/ext/IO-Compress/t/108anyunc-deflate.t
diff --git a/ext/IO_Compress_Zlib/t/108anyunc-gzip.t b/ext/IO-Compress/t/108anyunc-gzip.t
index bac6a6a9d0..bac6a6a9d0 100644
--- a/ext/IO_Compress_Zlib/t/108anyunc-gzip.t
+++ b/ext/IO-Compress/t/108anyunc-gzip.t
diff --git a/ext/IO_Compress_Zlib/t/108anyunc-rawdeflate.t b/ext/IO-Compress/t/108anyunc-rawdeflate.t
index 7d85dada9a..7d85dada9a 100644
--- a/ext/IO_Compress_Zlib/t/108anyunc-rawdeflate.t
+++ b/ext/IO-Compress/t/108anyunc-rawdeflate.t
diff --git a/ext/IO_Compress_Zlib/t/108anyunc-transparent.t b/ext/IO-Compress/t/108anyunc-transparent.t
index 687b1f5cd2..687b1f5cd2 100644
--- a/ext/IO_Compress_Zlib/t/108anyunc-transparent.t
+++ b/ext/IO-Compress/t/108anyunc-transparent.t
diff --git a/ext/IO_Compress_Zlib/t/108anyunc-zip.t b/ext/IO-Compress/t/108anyunc-zip.t
index 72e015a6a1..72e015a6a1 100644
--- a/ext/IO_Compress_Zlib/t/108anyunc-zip.t
+++ b/ext/IO-Compress/t/108anyunc-zip.t
diff --git a/ext/IO_Compress_Zlib/t/109merge-deflate.t b/ext/IO-Compress/t/109merge-deflate.t
index a489f354d3..a489f354d3 100644
--- a/ext/IO_Compress_Zlib/t/109merge-deflate.t
+++ b/ext/IO-Compress/t/109merge-deflate.t
diff --git a/ext/IO_Compress_Zlib/t/109merge-gzip.t b/ext/IO-Compress/t/109merge-gzip.t
index 3041a99420..3041a99420 100644
--- a/ext/IO_Compress_Zlib/t/109merge-gzip.t
+++ b/ext/IO-Compress/t/109merge-gzip.t
diff --git a/ext/IO_Compress_Zlib/t/109merge-rawdeflate.t b/ext/IO-Compress/t/109merge-rawdeflate.t
index 2c9663726e..2c9663726e 100644
--- a/ext/IO_Compress_Zlib/t/109merge-rawdeflate.t
+++ b/ext/IO-Compress/t/109merge-rawdeflate.t
diff --git a/ext/IO_Compress_Zlib/t/109merge-zip.t b/ext/IO-Compress/t/109merge-zip.t
index 74adf09bf9..74adf09bf9 100644
--- a/ext/IO_Compress_Zlib/t/109merge-zip.t
+++ b/ext/IO-Compress/t/109merge-zip.t
diff --git a/ext/IO-Compress/t/110encode-bzip2.t b/ext/IO-Compress/t/110encode-bzip2.t
new file mode 100644
index 0000000000..974dc8f24a
--- /dev/null
+++ b/ext/IO-Compress/t/110encode-bzip2.t
@@ -0,0 +1,21 @@
+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 IO::Compress::Bzip2 qw($Bzip2Error) ;
+use IO::Uncompress::Bunzip2 qw($Bunzip2Error) ;
+
+sub identify
+{
+ 'IO::Compress::Bzip2';
+}
+
+require "encode.pl" ;
+run();
diff --git a/ext/IO_Compress_Zlib/t/110encode-deflate.t b/ext/IO-Compress/t/110encode-deflate.t
index a1f93a9512..a1f93a9512 100644
--- a/ext/IO_Compress_Zlib/t/110encode-deflate.t
+++ b/ext/IO-Compress/t/110encode-deflate.t
diff --git a/ext/IO_Compress_Zlib/t/110encode-gzip.t b/ext/IO-Compress/t/110encode-gzip.t
index d40c36e905..d40c36e905 100644
--- a/ext/IO_Compress_Zlib/t/110encode-gzip.t
+++ b/ext/IO-Compress/t/110encode-gzip.t
diff --git a/ext/IO_Compress_Zlib/t/110encode-rawdeflate.t b/ext/IO-Compress/t/110encode-rawdeflate.t
index 58fa7417b1..58fa7417b1 100644
--- a/ext/IO_Compress_Zlib/t/110encode-rawdeflate.t
+++ b/ext/IO-Compress/t/110encode-rawdeflate.t
diff --git a/ext/IO_Compress_Zlib/t/110encode-zip.t b/ext/IO-Compress/t/110encode-zip.t
index 80e99eec58..80e99eec58 100644
--- a/ext/IO_Compress_Zlib/t/110encode-zip.t
+++ b/ext/IO-Compress/t/110encode-zip.t
diff --git a/ext/IO-Compress/t/999pod.t b/ext/IO-Compress/t/999pod.t
new file mode 100644
index 0000000000..760f737716
--- /dev/null
+++ b/ext/IO-Compress/t/999pod.t
@@ -0,0 +1,16 @@
+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();
+
diff --git a/ext/IO-Compress/t/99pod.t b/ext/IO-Compress/t/99pod.t
new file mode 100644
index 0000000000..760f737716
--- /dev/null
+++ b/ext/IO-Compress/t/99pod.t
@@ -0,0 +1,16 @@
+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();
+
diff --git a/ext/Compress-Zlib/t/01version.t b/ext/IO-Compress/t/cz-01version.t
index 9d6f283a52..9d6f283a52 100644
--- a/ext/Compress-Zlib/t/01version.t
+++ b/ext/IO-Compress/t/cz-01version.t
diff --git a/ext/Compress-Zlib/t/05examples.t b/ext/IO-Compress/t/cz-05examples.t
index 48dad73c87..5a8fb33e20 100644
--- a/ext/Compress-Zlib/t/05examples.t
+++ b/ext/IO-Compress/t/cz-05examples.t
@@ -37,8 +37,8 @@ my $Perl = ($ENV{'FULLPERL'} or $^X or 'perl') ;
$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
diff --git a/ext/Compress-Zlib/t/06gzsetp.t b/ext/IO-Compress/t/cz-06gzsetp.t
index 0f8d83d5ac..0f8d83d5ac 100644
--- a/ext/Compress-Zlib/t/06gzsetp.t
+++ b/ext/IO-Compress/t/cz-06gzsetp.t
diff --git a/ext/Compress-Zlib/t/08encoding.t b/ext/IO-Compress/t/cz-08encoding.t
index f377609e57..f377609e57 100644
--- a/ext/Compress-Zlib/t/08encoding.t
+++ b/ext/IO-Compress/t/cz-08encoding.t
diff --git a/ext/Compress-Zlib/t/14gzopen.t b/ext/IO-Compress/t/cz-14gzopen.t
index 85970d26b8..e876143b29 100644
--- a/ext/Compress-Zlib/t/14gzopen.t
+++ b/ext/IO-Compress/t/cz-14gzopen.t
@@ -20,150 +20,161 @@ BEGIN {
$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
@@ -172,89 +183,96 @@ the line after the previous 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" ;
+}
{
@@ -264,11 +282,12 @@ ok ! $fil->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' ;
@@ -314,7 +333,7 @@ ok ! $fil->gzclose ;
$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" ;
@@ -346,7 +365,7 @@ ok ! $fil->gzclose ;
open F, "<$name" ;
ok $fil = gzopen(*F, "rb") ;
- my $uncmomp;
+ my $uncomp; my $x;
$x = $fil->gzread($uncomp);
is $x, $len ;
@@ -393,7 +412,7 @@ foreach my $stdio ( ['-', '-'], [*STDIN, *STDOUT])
ok $fil = gzopen($stdin, "rb") ;
- my $uncmomp;
+ my $uncomp; my $x;
ok (($x = $fil->gzread($uncomp)) == $len)
or print "# length $x, expected $len\n" ;
@@ -451,7 +470,7 @@ foreach my $stdio ( ['-', '-'], [*STDIN, *STDOUT])
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" ;
@@ -497,7 +516,7 @@ foreach my $stdio ( ['-', '-'], [*STDIN, *STDOUT])
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 ;
diff --git a/ext/IO-Compress/t/cz-99pod.t b/ext/IO-Compress/t/cz-99pod.t
new file mode 100644
index 0000000000..760f737716
--- /dev/null
+++ b/ext/IO-Compress/t/cz-99pod.t
@@ -0,0 +1,16 @@
+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();
+
diff --git a/ext/IO_Compress_Base/t/globmapper.t b/ext/IO-Compress/t/globmapper.t
index 10a4d88716..10a4d88716 100644
--- a/ext/IO_Compress_Base/t/globmapper.t
+++ b/ext/IO-Compress/t/globmapper.t
diff --git a/ext/IO_Compress_Base/Changes b/ext/IO_Compress_Base/Changes
deleted file mode 100644
index 92142be4fb..0000000000
--- a/ext/IO_Compress_Base/Changes
+++ /dev/null
@@ -1,194 +0,0 @@
-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 $.
-
diff --git a/ext/IO_Compress_Base/pod/FAQ.pod b/ext/IO_Compress_Base/pod/FAQ.pod
deleted file mode 100644
index 16930fac27..0000000000
--- a/ext/IO_Compress_Base/pod/FAQ.pod
+++ /dev/null
@@ -1,346 +0,0 @@
-
-=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.
-
diff --git a/ext/IO_Compress_Base/private/MakeUtil.pm b/ext/IO_Compress_Base/private/MakeUtil.pm
deleted file mode 100644
index e595910654..0000000000
--- a/ext/IO_Compress_Base/private/MakeUtil.pm
+++ /dev/null
@@ -1,381 +0,0 @@
-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;
-
-
diff --git a/ext/IO_Compress_Zlib/Changes b/ext/IO_Compress_Zlib/Changes
deleted file mode 100644
index dfcb3781b1..0000000000
--- a/ext/IO_Compress_Zlib/Changes
+++ /dev/null
@@ -1,194 +0,0 @@
-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
-
-
-
diff --git a/ext/IO_Compress_Zlib/Makefile.PL b/ext/IO_Compress_Zlib/Makefile.PL
deleted file mode 100644
index 854b1d9898..0000000000
--- a/ext/IO_Compress_Zlib/Makefile.PL
+++ /dev/null
@@ -1,67 +0,0 @@
-#! 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
-
diff --git a/ext/IO_Compress_Zlib/README b/ext/IO_Compress_Zlib/README
deleted file mode 100644
index a61d40a6c2..0000000000
--- a/ext/IO_Compress_Zlib/README
+++ /dev/null
@@ -1,107 +0,0 @@
-
- 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>
diff --git a/ext/IO_Compress_Zlib/examples/unzip b/ext/IO_Compress_Zlib/examples/unzip
deleted file mode 100644
index 0623253db0..0000000000
--- a/ext/IO_Compress_Zlib/examples/unzip
+++ /dev/null
@@ -1,73 +0,0 @@
-
-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 ;
-}
-
-
diff --git a/ext/IO_Compress_Zlib/private/MakeUtil.pm b/ext/IO_Compress_Zlib/private/MakeUtil.pm
deleted file mode 100644
index e595910654..0000000000
--- a/ext/IO_Compress_Zlib/private/MakeUtil.pm
+++ /dev/null
@@ -1,381 +0,0 @@
-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;
-
-
diff --git a/t/lib/compress/generic.pl b/t/lib/compress/generic.pl
index befe281b2a..f65b8d9810 100644
--- a/t/lib/compress/generic.pl
+++ b/t/lib/compress/generic.pl
@@ -18,7 +18,7 @@ BEGIN
$extra = 1
if $st ;
- plan(tests => 670 + $extra) ;
+ plan(tests => 675 + $extra) ;
}
sub myGZreadFile
@@ -58,12 +58,14 @@ sub run
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);
@@ -90,18 +92,22 @@ sub run
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);
diff --git a/t/lib/compress/merge.pl b/t/lib/compress/merge.pl
index 7811966e84..7083b3bb15 100644
--- a/t/lib/compress/merge.pl
+++ b/t/lib/compress/merge.pl
@@ -91,7 +91,7 @@ sub run
{
if ($to_file) {
- is $$Error, "Output file '$out_file' is not writable",
+ like $$Error, "/Permission denied/",
" Got non-writable filename message" ;
}
else {
@@ -137,7 +137,7 @@ sub run
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" ;
}
}
diff --git a/t/lib/compress/multi.pl b/t/lib/compress/multi.pl
index cfb5666f6c..3e9bbfd464 100644
--- a/t/lib/compress/multi.pl
+++ b/t/lib/compress/multi.pl
@@ -13,7 +13,7 @@ BEGIN {
$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)) ;
@@ -47,6 +47,9 @@ EOM
even more stuff
EOM
+ my $b0length = length $buffers[0];
+ my $bufcount = @buffers;
+
{
my $cc ;
my $gz ;
@@ -136,6 +139,46 @@ EOM
}
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')
@@ -195,7 +238,8 @@ EOM
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" ;
diff --git a/t/lib/compress/oneshot.pl b/t/lib/compress/oneshot.pl
index 0646958d89..4f8bb83ac6 100644
--- a/t/lib/compress/oneshot.pl
+++ b/t/lib/compress/oneshot.pl
@@ -16,7 +16,7 @@ BEGIN {
$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)) ;
@@ -42,6 +42,9 @@ sub run
my $Func = getTopFuncRef($bit);
my $TopType = getTopFuncName($bit);
+ #my $inverse = getInverse($bit);
+ #my $InverseFunc = getTopFuncRef($inverse);
+
title "Testing $TopType Error Cases";
my $a;
@@ -510,6 +513,7 @@ sub run
my $TopTypeInverse = getInverse($bit);
my $FuncInverse = getTopFuncRef($TopTypeInverse);
+ my $ErrorInverse = getErrorRef($TopTypeInverse);
my $lex = new LexFile(my $file1, my $file2) ;
@@ -606,6 +610,34 @@ sub run
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";
+ }
}
}