1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
#!/usr/bin/perl
use common::sense;
use File::Unpack;
my %hash = ('path' => './archive/attic.bz2', 'dest' => './unpack');
extract( \%hash );
sub extract {
my $log;
my $u = File::Unpack->new(destdir => $_[0]->{'dest'}, one_shot => 1, verbose => 2, logfile => \$log);
$u->unpack( $_[0]->{'path'} );
}
1
2
3
4
5
6
7
8
sh-3.2$ ./extract.pl
Use of uninitialized value $r in numeric ne (!=) at /usr/local/share/perl/5.10.0/File/Unpack.pm line 394.
Use of uninitialized value $r in concatenation (.) or string at /usr/local/share/perl/5.10.0/File/Unpack.pm line 394.
=log(SCALAR(0xa5373e0)): write failed: {"fu":"0.46","input":"/home/constrain/perl/gscp/archive/attic.bz2","pid":16173,"destdir":"/home/constrain/perl/gscp/unpack","start":"Sun Sep 11 19:53:01 2011", "unpacked":{
Use of uninitialized value $r in numeric ne (!=) at /usr/local/share/perl/5.10.0/File/Unpack.pm line 394.
Use of uninitialized value $r in concatenation (.) or string at /usr/local/share/perl/5.10.0/File/Unpack.pm line 394.
(in cleanup) =log(SCALAR(0xa5373e0)): write failed: {"pid":"16173", "unpacked":{
1 2 3 4 5 6 7 8 9 10
sub log { my ($self, $text) = @_; if (my $fp = $self->{lfp}) { my $r = $fp->syswrite($text); die "$r=log($self->{logfile}): write failed: $text\n" if $r != length($text); $self->{lfp_printed}++; } }
1 2 3 4 5 6 7 8 9
sub log { my ($self, $text) = @_; if (my $fp = $self->{lfp}) { die "log($self->{logfile}): print failed: $text\n" if(!$fp->print($text)); $self->{lfp_printed}++; } }
1 2 3 4 5 6 7 8 9
sub File::Unpack::log { my ($self, $text) = @_; if (my $fp = $self->{lfp}) { die "log($self->{logfile}): print failed: $text\n" if(!$fp->print($text)); $self->{lfp_printed}++; } }