Beefy Boxes and Bandwidth Generously Provided by pair Networks
Come for the quick hacks, stay for the epiphanies.
 
PerlMonks  

Re: Archive::Tar->list_archive Properties

by toolic (Bishop)
on Mar 10, 2015 at 13:45 UTC ( [id://1119498]=note: print w/replies, xml ) Need Help??


in reply to Archive::Tar->list_archive Properties

use warnings; use strict; use Archive::Tar; use Data::Dumper; $Data::Dumper::Sortkeys=1; my @properties = qw(name size mtime); my $location = "xxx.tar"; my @files = Archive::Tar->list_archive($location, 0, \@properties); print Dumper(\@files);

Several issues:

  • Your @properties array has only 1 element, not 3.
  • [\@properties]: The squares brackets in the docs mean that the array ref is optional. You should omit the brackets in your code.
  • See Corion's explanation of the 2nd arg: $compressed
  • list_archive seems to return a list of hash refs, rather than a hash, which becomes more apparent when you use warnings.

Replies are listed 'Best First'.
Re^2: Archive::Tar->list_archive Properties
by hdb (Monsignor) on Mar 10, 2015 at 13:50 UTC

    Thanks for your comment on the return type, this makes much more sense!

Re^2: Archive::Tar->list_archive Properties
by sirhalos (Sexton) on Mar 10, 2015 at 15:40 UTC
    Thank you so much. I knew I must be close to the answer. This helped explain it.

Log In?
Username:
Password:

What's my password?
Create A New User
Domain Nodelet?
Node Status?
node history
Node Type: note [id://1119498]
help
Chatterbox?
and the web crawler heard nothing...

How do I use this?Last hourOther CB clients
Other Users?
Others learning in the Monastery: (2)
As of 2024-04-26 00:31 GMT
Sections?
Information?
Find Nodes?
Leftovers?
    Voting Booth?

    No recent polls found