Revision 91751883
Von Jan Büren vor fast 5 Jahren hinzugefügt
SL/GoBD.pm | ||
---|---|---|
10 | 10 |
|
11 | 11 |
use Text::CSV_XS; |
12 | 12 |
use XML::Writer; |
13 |
use Archive::Zip; |
|
14 | 13 |
use File::Temp (); |
15 | 14 |
use File::Spec (); |
15 |
use IO::Compress::Zip qw(zip $ZipError); |
|
16 | 16 |
use List::MoreUtils qw(any); |
17 | 17 |
use List::UtilsBy qw(partition_by sort_by); |
18 | 18 |
|
... | ... | |
180 | 180 |
|
181 | 181 |
# make zip |
182 | 182 |
my ($fh, $zipfile) = File::Temp::tempfile(); |
183 |
my $zip = Archive::Zip->new; |
|
184 |
|
|
183 |
my (@files, %name_subs); |
|
185 | 184 |
while (my ($name, $file) = each %{ $self->files }) { |
186 |
$zip->addFile($file, $name); |
|
185 |
push @files, $file; |
|
186 |
$name_subs{$file} = $name; |
|
187 | 187 |
} |
188 | 188 |
|
189 |
$zip->writeToFileHandle($fh) == Archive::Zip::AZ_OK() or die 'error writing zip file';
|
|
190 |
close($fh);
|
|
189 |
zip \@files => $zipfile, FilterName => sub { s/.*/$name_subs{$_}/; }
|
|
190 |
or die "zip failed: $ZipError\n";
|
|
191 | 191 |
|
192 | 192 |
return $zipfile; |
193 | 193 |
} |
Auch abrufbar als: Unified diff
DATEV- und GoBD-Export auf Compress::IO umgestellt