in reply to Is there an IO::*-like interface for accessing tar files?

Were you thinking of something like the IO::Dir interface for walking the contents of the tar file, or something to handle each of the files within? How would you handle tar archives where there are multiple copies of the same file in the archive?

The difference (which you, but not those asking, may already know) between the other two file types and a tar archive is that the first two are single files, while a tar archive is more like a directory, with the potential of multiple instances of a file within.

Update: Does nextStream from IO::Uncompress::AnyUncompress do what you are thinking of for getting individual files from the archive? Is that the interface you are considering?

--MidLifeXis

  • Comment on Re: Is there an IO::*-like interface for accessing tar files?

Replies are listed 'Best First'.
Re^2: Is there an IO::*-like interface for accessing tar files?
by atcroft (Abbot) on Feb 25, 2015 at 23:51 UTC

    Thank you for the feedback.

    I was looking for something to read the contents of the file (a compressed archive of log files, for the curious). If possible, I was trying to retain the use of the close(), getline(), and input_line_number calls from the IO::* modules, so I could localize my dependent logic to one place.

    I looked at the nextStream method you suggested, but it did not appear to do what I needed.

      Since a tar file contains an index, how would the getline() method behave? Would you anticipate being able to iterate through each file within the tar file and then use an IO:: object on each virtual file within that archive (where getline() would apply)?

      Just trying to clarify your expectations for my understanding.

      --MidLifeXis

        Yes, ideally a way to access (iterate through?) the contained files, and for a particular contained file a way to read line by line through that file.