"Andrew Hamm" <> wrote:
> Perl 5.8.0
> Archive::Tar 1.05
I have 0.22, however...
> The doco for the write method says:
>
> $tar->write ( [$file, $compressed, $prefix] )
> Write the in-memory archive to disk. The first argument
> can either be the name of a file or a reference to an
[...]
> But using either of these:
>
> open FH, "| filter" or die "cannot pipe to filter: $!\n";
> my $fh = IO::File->new("| filter") or die "cannot pipe to filter: $!\n";
I don't know why you'll want to write to a pipe. With my Archive::Tar
version writing to a pipe gives a
Can't call method "gzwrite" on unblessed reference at
/usr/lib/perl5/site_perl/5.005/Archive/Tar.pm line 521.
> with any of these:
>
> $tar->write(*FH);
> $tar->write(\*FH);
> $tar->write($fh);
>
> I just end up with a file called 'GLOB(hexnum)' or 'REF(hexnum)' or
> 'IO::File=GLOB(hexnum)'.
Try something like the following:
$tar->add_files("foo", "bar", "froz", "foobar");
open TARFILE, ">foo.tar" or die "Cannot open tarfile:$!\n";
$tar->write(*TARFILE{IO}); # or \*TARFILE or *TARFILE{FILEHANDLE}
close TARFILE;
That should give you a foo.tar file including the four archive
members.
Cheers
Jens
--
(Intentionally left blank.)
|