summaryrefslogtreecommitdiffstats
path: root/lib
diff options
context:
space:
mode:
authorOliver Tappe2008-01-22 21:04:21 +0100
committerOliver Tappe2008-01-22 21:04:21 +0100
commitaaacf7ee3eb2b0736fb82bb1afeb05c9c687fbcc (patch)
treeeeee21e2c36cbdc7e3a64fafea90337e5416e7fa /lib
parent* added support to the OSExport engine for determining the (diff)
downloadcore-aaacf7ee3eb2b0736fb82bb1afeb05c9c687fbcc.tar.gz
core-aaacf7ee3eb2b0736fb82bb1afeb05c9c687fbcc.tar.xz
core-aaacf7ee3eb2b0736fb82bb1afeb05c9c687fbcc.zip
* added support to spitFile() for setting the mode of the
file, too git-svn-id: http://svn.openslx.org/svn/openslx/trunk@1486 95ad53e4-c205-0410-b2fa-d234c58c8868
Diffstat (limited to 'lib')
-rw-r--r--lib/OpenSLX/Utils.pm10
1 files changed, 7 insertions, 3 deletions
diff --git a/lib/OpenSLX/Utils.pm b/lib/OpenSLX/Utils.pm
index 5ced685e..a47a1ea7 100644
--- a/lib/OpenSLX/Utils.pm
+++ b/lib/OpenSLX/Utils.pm
@@ -129,16 +129,20 @@ sub spitFile
checkParams($flags, {
'io-layer' => '?',
+ 'mode' => '?',
});
my $ioLayer = $flags->{'io-layer'} || 'utf8';
my $fh;
open($fh, ">:$ioLayer", $fileName)
- or croak _tr("unable to create file '%s' (%s)\n", $fileName, $!);
+ or croak _tr("unable to create file '%s' (%s)\n", $fileName, $!);
print $fh $content
- or croak _tr("unable to print to file '%s' (%s)\n", $fileName, $!);
+ or croak _tr("unable to print to file '%s' (%s)\n", $fileName, $!);
close($fh)
- or croak _tr("unable to close file '%s' (%s)\n", $fileName, $!);
+ or croak _tr("unable to close file '%s' (%s)\n", $fileName, $!);
+ if (defined $flags->{mode}) {
+ chmod $flags->{mode}, $fileName;
+ }
return;
}