Cleanup: to_zip should be chainable to always reset after to_zip
Change-Id: I24a0bb0b24657cfbc722567550789278926d287c
diff --git a/lib/KorAP/XML/TEI/Annotations.pm b/lib/KorAP/XML/TEI/Annotations.pm
index 2f7895a..ab450fc 100644
--- a/lib/KorAP/XML/TEI/Annotations.pm
+++ b/lib/KorAP/XML/TEI/Annotations.pm
@@ -56,8 +56,9 @@
# Write data to zip stream
sub to_zip {
- my ($self, $zip, $text_id) = @_;
- $zip->print(encode('UTF-8', $self->to_string($text_id)));
+ my ($self, $zip, $text_id, $param) = @_;
+ $zip->print(encode('UTF-8', $self->to_string($text_id, $param)));
+ return $self;
};
diff --git a/lib/KorAP/XML/TEI/Annotations/Collector.pm b/lib/KorAP/XML/TEI/Annotations/Collector.pm
index ed11d23..510d339 100644
--- a/lib/KorAP/XML/TEI/Annotations/Collector.pm
+++ b/lib/KorAP/XML/TEI/Annotations/Collector.pm
@@ -1,7 +1,6 @@
package KorAP::XML::TEI::Annotations::Collector;
use base 'KorAP::XML::TEI::Annotations';
use KorAP::XML::TEI::Annotations::Annotation;
-use Encode qw(encode decode);
use Log::Any '$log';
use strict;
use warnings;
@@ -91,11 +90,4 @@
};
-# Write data to zip stream (as utf8)
-sub to_zip {
- my ($self, $zip, $text_id, $param) = @_;
- $zip->print(encode('UTF-8', $self->to_string($text_id, $param)));
-};
-
-
1;
diff --git a/lib/KorAP/XML/TEI/Data.pm b/lib/KorAP/XML/TEI/Data.pm
index 0de4aca..9d4b71c 100644
--- a/lib/KorAP/XML/TEI/Data.pm
+++ b/lib/KorAP/XML/TEI/Data.pm
@@ -93,6 +93,7 @@
# which are counted as 1 (search for '&' in data.xml and see
# corresponding indices in $_tokens_file)
$zip->print(encode('UTF-8', $self->to_string($text_id)));
+ return $self;
};
diff --git a/lib/KorAP/XML/TEI/Header.pm b/lib/KorAP/XML/TEI/Header.pm
index b5b92dc..870a2f9 100644
--- a/lib/KorAP/XML/TEI/Header.pm
+++ b/lib/KorAP/XML/TEI/Header.pm
@@ -168,6 +168,7 @@
sub to_zip {
my ($self, $zip) = @_;
$zip->print(encode('UTF-8', $self->to_string));
+ return $self;
};