Move get_file_from_glob() as a function to Krill.pm and test it

Change-Id: I16aea108f7df3190074c5f1113856c12c6480150
diff --git a/script/korapxml2krill b/script/korapxml2krill
index 54edaa8..0138423 100644
--- a/script/korapxml2krill
+++ b/script/korapxml2krill
@@ -12,7 +12,7 @@
 use Pod::Usage;
 use Cache::FastMmap;
 use Directory::Iterator;
-use KorAP::XML::Krill;
+use KorAP::XML::Krill qw!get_file_name_from_glob!;
 use KorAP::XML::Archive;
 use KorAP::XML::Tokenizer;
 use KorAP::XML::Batch::File;
@@ -162,7 +162,6 @@
 VERSION
 
 # Prototypes
-sub get_file_name_from_glob($);
 sub get_file_name($);
 
 # Parse comand
@@ -633,19 +632,6 @@
 };
 
 
-sub get_file_name_from_glob ($) {
-  my $glob = shift;
-  $glob =~ s![\\\/]!-!g;        # Transform paths
-  $glob =~ s/[\*\?]//g;         # Remove arbitrary fills
-  $glob =~ s/[\{\}\[\]]/-/g;    # Remove class and multiple brackets
-  $glob =~ s/\-\-+/-/g;         # Remove sequences of binding characters
-  $glob =~ s/^-//;              # Clean beginning
-  $glob =~ s/-$//;              # Clean end
-  $glob =~ s/\.zip$//;          # Remove file extension
-  return $glob;
-};
-
-
 # Convert sigle to path construct
 s!^\s*([^_]+?)_([^\.]+?)\.(.+?)\s*$!$1/$2/$3! foreach @sigle;