Heya,

I'm trying to write a simple program which adds, updates, removes or shows files from a .tar.gz file. For this purpose, I am of course using the Tar::Archive module. Then, when I try to add a file, checksum errors appear on the screen. The file size of the .tar.gz increases but the file is not there. I am using ActivePerl 5.6.1 on Windows XP Professional.

Part of the code:
use strict; use Archive::Tar; my $tar = Archive::Tar->new; #read "package.tar.gz" as a compressed file $tar->read("package.tar.gz", 1); #... $file = "addfile.txt"; #not using die here to prevent the "at pack.pl line x" part open THEFILE, "<$file" or do{print "Could not open $file: $!\n"; exit 1}; #get file contents $data = {local $/ = undef; <THEFILE>}; close THEFILE or do{print "Could not close $file: $!\n"; exit 1}; #create a file in the archive named after the original file, store +d in directory pagepack. #copy the contents of the file to the archived file $tar->add_files("pagepack/$file"); $tar->add_dat("pagepack/$file", $data); #save the file as a compressed archive #This is where the checksum errors seem to appear $tar->write("package.tar.gz", 1);


Whenever I try to access the archive again after this operation, I get the checksum errors again. What's wrong? Is this a bug? Do I do something wrong? I don't get it anymore...

my $native_language = "Dutch";
my $code = not $tested unless $specified{$otherwise};

In reply to checksum error in Archive::Tar by muba

Title:
Use:  <p> text here (a paragraph) </p>
and:  <code> code here </code>
to format your post, it's "PerlMonks-approved HTML":



  • Posts are HTML formatted. Put <p> </p> tags around your paragraphs. Put <code> </code> tags around your code and data!
  • Titles consisting of a single word are discouraged, and in most cases are disallowed outright.
  • Read Where should I post X? if you're not absolutely sure you're posting in the right place.
  • Please read these before you post! —
  • Posts may use any of the Perl Monks Approved HTML tags:
    a, abbr, b, big, blockquote, br, caption, center, col, colgroup, dd, del, details, div, dl, dt, em, font, h1, h2, h3, h4, h5, h6, hr, i, ins, li, ol, p, pre, readmore, small, span, spoiler, strike, strong, sub, summary, sup, table, tbody, td, tfoot, th, thead, tr, tt, u, ul, wbr
  • You may need to use entities for some characters, as follows. (Exception: Within code tags, you can put the characters literally.)
            For:     Use:
    & &amp;
    < &lt;
    > &gt;
    [ &#91;
    ] &#93;
  • Link using PerlMonks shortcuts! What shortcuts can I use for linking?
  • See Writeup Formatting Tips and other pages linked from there for more info.