From 023ed22a3ee050f4b0a1667b42b639e24aaa9a39 Mon Sep 17 00:00:00 2001
From: Andreas Romeyke <andreas.romeyke@slub-dresden.de>
Date: Thu, 27 Apr 2023 14:13:58 +0200
Subject: [PATCH] - added check for cache-Dir

---
 lib/SLUB/LZA/Rosetta/TA.pm | 6 +++++-
 1 file changed, 5 insertions(+), 1 deletion(-)

diff --git a/lib/SLUB/LZA/Rosetta/TA.pm b/lib/SLUB/LZA/Rosetta/TA.pm
index f12c97d..3bd3eb9 100644
--- a/lib/SLUB/LZA/Rosetta/TA.pm
+++ b/lib/SLUB/LZA/Rosetta/TA.pm
@@ -49,7 +49,11 @@ BEGIN {
 }
 
 END {
-    YAML::DumpFile($cache_path, %cache);
+    if ($cache_path->parent->is_dir && !$cache_path->parent->parent->is_rootdir && $cache_path->touch()) {
+        YAML::DumpFile($cache_path, %cache)
+    } else {
+        warn "The $cache_path could not be written, because dir ".$cache_path->parent()." is not writeable";
+    }
 }
 
 1;
-- 
GitLab