in reply to Cannot add "folder" information to Archive::Tar->add_data in Win32 (ActivePerl)

graff: I use WinRAR and WinZip tools to unpack the TGZ file I produce using the script. It always used to show me the directories from the TAR file. In fact I can still use these 2 tools to open & see directories on older TGZ files created by my other Perl scripts. Unfortunately these tools aren't showing the dir info in the TAR file created using the script I showed here. When I was debugging this issue and was trying to force the longlink flag to true in Archive.pm it tried to produce the directory in the TAR file, which my Zip and RAR programs were able to identify. The TAR file itself had a slight increase in size due to storing dir info. But I reinstated the original Tar.pm file to its original state so as to not tinker with it. So thisis how I am pretty positive that the TAR produced by my script isn't storing dir info in the file. If it's my Winzip or WinRAR that's the problem, they can't show due info on similar TAR files produced by my scripts using an older Archive::Tar. Right? Please help.
  • Comment on Re: Cannot add "folder" information to Archive::Tar->add_data in Win32 (ActivePerl)

Replies are listed 'Best First'.
Re^2: Cannot add "folder" information to Archive::Tar->add_data in Win32 (ActivePerl)
by graff (Chancellor) on Nov 05, 2009 at 14:49 UTC
    If you modified Tar.pm, causing it to do the right thing with directory structure, and then you reverted to the original Tar.pm, which made it stop doing the right thing, you should report this to the module author, including the test script and the modification that you made to the code. (And you should keep using the modified version of the module.)

    Be sure to include the output of "perl -V" when reporting to the module author.

      graff:

      Thanks a lot. I think I have figure out what is going on here. As you said, the "path" info is there, it is just not being identified as such through WinZip and WinRAR programs. What is still a mystery is that the old Archive::Tar generated TAR.GZ files through my Perl script are still being able to be identified through WinZip and WinRAR, but not the new ones.

      Also, as I said, when I purposefully try to set the longlink flag, even the current WinZip and WinRAR programs identify the path info, but why I can't have that as a solution is because when I forcefully turn this longlink info, it chops of 1 character in the filename. Duh! But, I think the Archive::Tar itself is NOT buggy. That's because, subsequent to what you stated, I wrote another Archive::Tar perl script to read the contents of the archive and explode it. Here it did the right thing. It deflated it to "qa" and "test" directories as I expected it. However, WinZip and WinRAR do NOT do that: Here is the code and thanks for your help.
      use strict; use Archive::Tar; my $tar = Archive::Tar->new; my @numFiles = $tar->read('test.tar.gz') ; $_->extract for(@numFiles); $tar->clear; undef $tar;