Re: Probleme mit Archive::Tar
David Haller <[email protected]>
| Newsgroups | gmane.linux.suse.programming |
|---|---|
| Message-ID | <[email protected]> |
Hallo,
Am Die, 13 Jun 2006, Ferdinand Ihringer schrieb:
> Am Montag, 12. Juni 2006 23:36 schrieb Ralph MÃŒller:
>[...]
>> Irgendwie scheint Archive::Tar eine andere (ressourcenfressendere)
>> Arbeitsmethode zu benutzen als /bin/tar, weil bei /bin/tar tritt
>> _dieses_ Problem nicht auf.
>
>man Archive::Tar
>
>'Isn't Archive::Tar heavier on memory than /bin/tar?
>Yes it is, see previous answer. Since "Compress::Zlib" and
>therefore "IO::Zlib" doesn't support "seek" on their filehandles, there is
>little choice but to read the archive into memory. This is ok if you want to
>do in-memory manipulation of the archive. If you just want to extract, use
>the "extract_archive" class method instead. It will optimize and write to
>disk immediately."'
Archive::TarGzip scheint dies nicht zu machen.
====
use Archive::TarGzip;
my @files;
sub scan {
-f && push(@files, $File::Find::name);
}
sub compress {
Archive::TarGzip->tar( @files,
{ tar_file => "/tmp/backup.tar.gz", compress => 1 } )
or die "$!\n";
}
@files = undef;
find( { wanted => \&scan, postprocess => \&compress }, "/tmp");
====
Oder irgendwie so. Es kann Probleme geben mit:
1. compress als postprocess:
"postprocess"
The value should be a code reference. It is invoked
just before leaving the currently processed directory.
D.h. compress wird auch fuer jedes Unterverzeichnis aufgerufen!
2. Das Archiv wird ins einzupackende Verzeichnis /tmp geschrieben.
Das solltest du passend aendern. Z.B. so:
====
#!/usr/bin/perl -w
use strict;
use Archive::TarGzip;
my @files;
sub scan {
-f && push(@files, $File::Find::name);
}
@files = undef;
find( { wanted => \&scan }, "/tmp");
Archive::TarGzip->tar( @files,
{ tar_file => "/tmp/backup.tar.gz", compress => 1 } )
or die "$!\n";
====
Alles ungetestet!
-dnh
--
17: Vollkompatibel zur Datenautobahn
GerÀt verfÌgt Ìber eine serielle Schnittstelle. (Peter Berlich)
--
Um die Liste abzubestellen, schicken Sie eine Mail an:
[email protected]
Um eine Liste aller verfÃŒgbaren Kommandos zu bekommen, schicken
Sie eine Mail an: [email protected]