diff options
author | Oliver Tappe | 2007-03-13 00:15:47 +0100 |
---|---|---|
committer | Oliver Tappe | 2007-03-13 00:15:47 +0100 |
commit | 8c0e56619cb53a8396581fc07fb49fdf67b2bbb3 (patch) | |
tree | 72716247474e06cc3bd9191d8f0920cd8c633350 /lib/OpenSLX/Utils.pm | |
parent | * added distro specific part for os-export and put default export-filter there (diff) | |
download | core-8c0e56619cb53a8396581fc07fb49fdf67b2bbb3.tar.gz core-8c0e56619cb53a8396581fc07fb49fdf67b2bbb3.tar.xz core-8c0e56619cb53a8396581fc07fb49fdf67b2bbb3.zip |
* added an option to slurpFile() which causes it to not fail in case the required
file doesn't exist.
git-svn-id: http://svn.openslx.org/svn/openslx/trunk@762 95ad53e4-c205-0410-b2fa-d234c58c8868
Diffstat (limited to 'lib/OpenSLX/Utils.pm')
-rw-r--r-- | lib/OpenSLX/Utils.pm | 7 |
1 files changed, 5 insertions, 2 deletions
diff --git a/lib/OpenSLX/Utils.pm b/lib/OpenSLX/Utils.pm index 3ec46dea..cb43c6ea 100644 --- a/lib/OpenSLX/Utils.pm +++ b/lib/OpenSLX/Utils.pm @@ -68,8 +68,11 @@ sub linkFile sub slurpFile { my $file = shift; - open(F, "< $file") - or die _tr("could not open file '%s' for reading! (%s)", $file, $!); + my $mayNotExist = shift; + + if (!open(F, "< $file") && !$mayNotExist) { + die _tr("could not open file '%s' for reading! (%s)", $file, $!); + } $/ = undef; my $text = <F>; close(F); |