Use IO::Scalar and pass it a reference to your unbzip2'ed data (tested):
#!/usr/bin/perl -w use strict; use Compress::Bzip2; use Archive::Tar; use IO::Scalar; use Data::Dumper; $Data::Dumper::Indent = 1; my $file = shift or die "usage: $0 filename.tar.bz2\n"; my $bz = bzopen($file,"r") or die; my ($out, $buf); $out .= $buf while $bz->bzread($buf) > 0; my $fh = IO::Scalar->new(\$out); my $tar = Archive::Tar->new; $tar->read($fh) or die "Cannot read from \$fh"; my @fileinfo = $tar->list_files([qw(name size)]); print Dumper(\@fileinfo);
--shmem
_($_=" "x(1<<5)."?\n".q·/)Oo. G°\ /
/\_¯/(q /
---------------------------- \__(m.====·.(_("always off the crowd"))."·
");sub _{s./.($e="'Itrs `mnsgdq Gdbj O`qkdq")=~y/"-y/#-z/;$e.e && print}
In reply to Re: Using Archive::Tar on tar data already in memory
by shmem
in thread Using Archive::Tar on tar data already in memory
by cengineer
| For: | Use: | ||
| & | & | ||
| < | < | ||
| > | > | ||
| [ | [ | ||
| ] | ] |