|
|
|
Clear questions and runnable code get the best and fastest answer |
|
| PerlMonks |
Re: reading zipped bzipped files!by johngg (Abbot) |
| on Dec 22, 2012 at 00:26 UTC ( #1009965=note: print w/ replies, xml ) | Need Help?? |
|
I wondered how this might be achieved so decided to have a go. I prepared a ZIP archive containing three bzip2'ed files (man page outputs) stored without further compression.
The following script constructs an Archive::Zip object to access the ZIP file and gets a list of member files. Then for each member it creates a member object and uses that to obtain the content. A reference to this content, by way of an on-the-fly subroutine, is used as the argument to the IO::Uncompress::Bunzip2 constructor which can then be read line by line. I just print the first five lines of each member file to demonstrate that the method works. I have not incorporated any error checking, this is left as an exercise for the reader.
The output.
I hope this is useful. Cheers, JohnGG
In Section
Seekers of Perl Wisdom
|
|
||||||||||||||||||||||||||