Introduce KORAPXMLTEI_DEBUG and document environment variables
Change-Id: I2d6232e475ea059ac1afee92a7fb088a39f61e7e
diff --git a/script/tei2korapxml b/script/tei2korapxml
index ed6b488..09f2a81 100755
--- a/script/tei2korapxml
+++ b/script/tei2korapxml
@@ -38,6 +38,8 @@
our $VERSION_MSG = "\ntei2korapxml - v$VERSION\n";
+# Set to 1 for minimal more debug output (no need to be parametrized)
+use constant DEBUG => $ENV{KORAPXMLTEI_DEBUG} // 0;
# Parse options from the command line
GetOptions(
@@ -66,6 +68,8 @@
Log::Any::Adapter->set('Stderr', log_level => $log_level);
+$log->notice('Debugging is activated') if DEBUG;
+
#
# ~~~ parameter (mandatory) ~~~
#
@@ -108,7 +112,6 @@
my $_tok_dir = "base"; # name of directory for storing tokenization files
-my $_DEBUG = 0; # set to 1 for minimal more debug output (no need to be parametrized)
my $_XCT_LN = 0; # only for debugging: include line numbers in elements of $tree_data
# (see also manpage of XML::CompactTree::XS)
@@ -286,7 +289,7 @@
# ~ recursion ~
retr_info(1, \$tree_data->[2] ); # parse input data
- if ($_DEBUG) {
+ if (DEBUG) {
$log->debug("Writing (utf8-formatted) xml file $dir/$_data_file");
};
@@ -423,7 +426,7 @@
# Write header to zip
my $file = $header->dir . '/' . $_header_file;
- $log->debug("Writing file $file") if $_DEBUG;
+ $log->debug("Writing file $file") if DEBUG;
$header->to_zip($zipper->new_stream($file));
@@ -868,6 +871,22 @@
=back
+=head1 ENVIRONMENT VARIABLES
+
+=over 2
+
+=item B<KORAPXMLTEI_DEBUG>
+
+Activate minimal debugging.
+Defaults to C<false>.
+
+=item B<KORAPXMLTEI_INLINE>
+
+Process inline annotations, if present.
+Defaults to C<false>.
+
+=back
+
=head1 COPYRIGHT AND LICENSE
Copyright (C) 2020, L<IDS Mannheim|https://www.ids-mannheim.de/>