From aaacf7ee3eb2b0736fb82bb1afeb05c9c687fbcc Mon Sep 17 00:00:00 2001 From: Oliver Tappe Date: Tue, 22 Jan 2008 20:04:21 +0000 Subject: * 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 --- lib/OpenSLX/Utils.pm | 10 +++++++--- 1 file changed, 7 insertions(+), 3 deletions(-) (limited to 'lib') 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; } -- cgit v1.2.3-55-g7522