Can't locate "extract_file" via "Archive::Tar"



I created a small test tarball using this UNIX command:

cd /tmp; ls >ls1.txt; ls >ls2.txt; tar czvf testing.tar.gz ls?.txt

I then ran this simple test script against it:

#!/usr/bin/perl
use strict; use warnings;
use Archive::Tar qw{ extract_file };

my $tar = Archive::Tar -> new;
$tar -> read('/tmp/testing.tar.gz') or die $!;

print "$_\n" for $tar -> list_files(); #it works.

$tar -> extract_file('ls1.txt'); # oops!

__END__

The script fails with this error:
Can't locate object method "extract_file" via package "Archive::Tar"
at...

That is, however, a valid method according to the perldocs:
http://search.cpan.org/~kane/Archive-Tar-1.29/lib/Archive/Tar.pm
and I did specifically import it (though I don't think I need to, and
it doesn't matter either way).

What am I doing wrong?

Thanks!

--
http://DavidFilmer.com

.



Relevant Pages