Simplify and centralize temporary file creation

Change-Id: I6674783e7707d66efea05d52381114779f3a64ee
diff --git a/t/script.t b/t/script.t
index 401d76b..8d17be6 100644
--- a/t/script.t
+++ b/t/script.t
@@ -2,18 +2,12 @@
 use warnings;
 use File::Basename 'dirname';
 use File::Spec::Functions qw/catfile/;
-use File::Temp qw/tempfile/;
 use IO::Uncompress::Unzip qw(unzip $UnzipError);
 
 use Test::More;
 use Test::Output;
-
 use Test::XML::Loy;
-
-our %ENV;
-# default: remove temp. file created by func. tempfile
-#  to keep temp. files use e.g. 'KORAPXMLTEI_DONTUNLINK=1 prove -lr t/script.t'
-my $_UNLINK = $ENV{KORAPXMLTEI_DONTUNLINK}?0:1;
+use Test::KorAP::XML::TEI qw!korap_tempfile!;
 
 my $f = dirname(__FILE__);
 my $script = catfile($f, '..', 'script', 'tei2korapxml');
@@ -35,7 +29,7 @@
 # Load example file
 my $file = catfile($f, 'data', 'goe_sample.i5.xml');
 
-my ($fh, $outzip) = tempfile("KorAP-XML-TEI_script_XXXXXXXXXX", SUFFIX => ".tmp", TMPDIR => 1, UNLINK => $_UNLINK);
+my ($fh, $outzip) = korap_tempfile('script_out');
 
 # Generate zip file (unportable!)
 stderr_like(
@@ -183,7 +177,7 @@
 # Tokenize with external tokenizer
 my $cmd = catfile($f, 'cmd', 'tokenizer.pl');
 
-my ($fh2, $outzip2) = tempfile("KorAP-XML-TEI_script_XXXXXXXXXX", SUFFIX => ".tmp", TMPDIR => 1, UNLINK => $_UNLINK);
+my ($fh2, $outzip2) = korap_tempfile('script_out2');
 
 stderr_like(
   sub { `cat '$file' | perl '$script' --tc='perl $cmd' > '$outzip2'` },
@@ -218,7 +212,7 @@
 # TODO: call $script with approp. parameter for internal tokenization (actual: '$_GEN_TOK_INT = 1' hardcoded)
 
 
-my ($fh3, $outzip3) = tempfile("KorAP-XML-TEI_script_XXXXXXXXXX", SUFFIX => ".tmp", TMPDIR => 1, UNLINK => $_UNLINK);
+my ($fh3, $outzip3) = korap_tempfile('script_out3');
 
 
 # ~ test conservative tokenization ~