I'm trying to use Archive::Tar to extract the contents of a large number of tarballs into a given directory. Super Search finds me lots of information on creating tarballs with this module, but I didn't really find anything on extracting the entire tarball. Archive::Tar module review was of some help.

foreach (@sorted){ my $tar = Archive::Tar->new($_); my @files = $tar->get_files; foreach my $file (@files){ $tar->extract_file($file, "./EXTRACTED/$_"); } }
This snippet of code gives me: "No such file in archive: 'Archive::Tar::File=HASH(0xa1189a4)'". Which I believe means $file is a hash ref. But I'm not sure where to go from here.

Where am I going wrong here?

Thanks,
Mike

Update: Thanks tlm & itub, list_files was the issue!


In reply to Archive::Tar extract_file by cajun

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.