I've spent alot of time googling and supersearching but haven't made much progress with this problem. I'd appreciate any feedback, references, etc. I'm using Archive::Tar to create and read tape header files on my Solaris 8 box (Perl 5.8, Archive::Tar 1.07). I started out using backtics w/gtar, but decided I'd might get better error handling using a Perl module.

Following the examples in the module documentation I arrived at the following:

use strict; use warnings; use Archive::Tar; my $device = '/dev/rmt/1'; my $tar = Archive::Tar->new(); warn $tar->error unless $tar->read($device); my $header_file = 'tape.header'; my @files = Archive::Tar->list_archive($device); my $junk = $tar->get_content($header_file) or die "### ERROR - No such file in archive: '$header_file'\n\n" +; __OUTPUT__ Warning: something's wrong at test.errors.pl line 7. No such file in archive: 'tape.header' at test.errors.pl line 11 ### ERROR - No such file in archive: 'tape.header'
The results bother me for three reasons:
  1. What's with the warning, is it an indicator that I'm trying to use tar->error in a way that it shouldn't be?
  2. Is it normal for Archive::Tar to burp warning messages ("No such . . .)? Shouldn't it just return warning/error codes and rely on the programmer to handle them?
  3. The first message is a Perl warning, not an Archive::Tar warning. I googled on "Warning: something's wrong at" and found an interesting but unrelated Re: "Database handle destroyed" quirks
As for #2 above, I know I can use $Archive::Tar::WARN = 0; but the module docs advise against it. Has anyone else experienced these problems and what can I do to eliminate them?

Thanks


In reply to Archive::Tar and error handling by Anonymous Monk

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.