| 1 | package Archive::Any::Create::Tar; | ||||||||||
| 2 | 1 | ▶ | use strict; | ||||||||
|
Subroutine
BEGIN: called CC=1 SCAR=0.0
| |||||||||||
| 3 | |||||||||||
| 4 | 1 | ▶ | use Archive::Tar; | ||||||||
|
Subroutine
BEGIN: called CC=1 SCAR=0.0
| |||||||||||
| 5 | |||||||||||
| 6 | 2 | ▶ | sub init { | ||||||||
|
Subroutine
init: called CC=1 SCAR=0.0
Pod
undocumented
| |||||||||||
| 7 | 2 | my $self = shift; | |||||||||
| 8 | 2 | my($opt) = @_; | |||||||||
| 9 | 2 | $self->{tar} = Archive::Tar->new; | |||||||||
| 10 | 2 | $self->{comp} = $opt->{comp}; | |||||||||
| 11 | } | ||||||||||
| 12 | |||||||||||
| 13 | 2 | ▶ | sub container { | ||||||||
|
Subroutine
container: called CC=1 SCAR=0.0
Pod
undocumented
| |||||||||||
| 14 | 2 | my $self = shift; | |||||||||
| 15 | 2 | my($dir) = @_; | |||||||||
| 16 | 2 | $self->{container} = $dir; | |||||||||
| 17 | } | ||||||||||
| 18 | |||||||||||
| 19 | 4 | ▶ | sub add_file { | ||||||||
|
Subroutine
add_file: called CC=1 SCAR=0.0
Pod
undocumented
| |||||||||||
| 20 | 4 | my $self = shift; | |||||||||
| 21 | 4 | my($file, $data) = @_; | |||||||||
| 22 | 4 | $self->{tar}->add_data($file, $data); | |||||||||
| 23 | } | ||||||||||
| 24 | |||||||||||
| 25 | 1 | ▶ | sub write_file { | ||||||||
|
Subroutine
write_file: called CC=1 SCAR=0.0
Pod
undocumented
| |||||||||||
| 26 | 1 | my $self = shift; | |||||||||
| 27 | 1 | return $self->write_filehandle(@_); # Accepts files or handles | |||||||||
| 28 | } | ||||||||||
| 29 | |||||||||||
| 30 | 2 | ▶ | sub write_filehandle { | ||||||||
|
Subroutine
write_filehandle: called CC=3 SCAR=11.3
Pod
undocumented
| |||||||||||
| 31 | 2 | my $self = shift; | |||||||||
| 32 | 2 | my($fh) = @_; | |||||||||
| 33 | 2 | ▶ | my $comp = $self->{comp} ? COMPRESS_GZIP : undef; | ||||||||
|
Branch: 1 branch
| |||||||||||
| 34 | $self->{tar}->write($fh, $comp, $self->{container}) | ||||||||||
| 35 | 2 | ▶ | or throw Archive::Any::Create::Error(error => $self->{tar}->error); | ||||||||
|
Branch: 1 branch
| |||||||||||
| 36 | 2 | 1; | |||||||||
| 37 | } | ||||||||||
| 38 | |||||||||||
| 39 | 1 | 1; | |||||||||