Code

new perl module used to create random file in /tmp
authorrettenbe <rettenbe@594d385d-05f5-0310-b6e9-bd551577e9d8>
Fri, 7 Nov 2008 13:16:48 +0000 (13:16 +0000)
committerrettenbe <rettenbe@594d385d-05f5-0310-b6e9-bd551577e9d8>
Fri, 7 Nov 2008 13:16:48 +0000 (13:16 +0000)
git-svn-id: https://oss.gonicus.de/repositories/gosa/branches/2.6-lhm@12966 594d385d-05f5-0310-b6e9-bd551577e9d8

gosa-si/client/events/gosaTriggered.pm

index 6edc2758f383a9b398898e0db87c36770ca19461..dca6f63088b9a377e52069f3d6a7bfc076c4900a 100644 (file)
@@ -50,7 +50,7 @@ use warnings;
 use GOSA::GosaSupportDaemon;
 use Data::Dumper;
 use MIME::Base64;
-use Data::Random qw(:all);
+use File::Temp qw/ tempfile/;
 
 BEGIN {}
 
@@ -126,10 +126,9 @@ sub usr_msg {
     my $subject = &decode_base64(@{$msg_hash->{'subject'}}[0]);
     my $message = &decode_base64(@{$msg_hash->{'message'}}[0]);
 
-    my $rand_file = "/tmp/goto_notify_".join("",rand_chars(set=>'alphanumeric', min=>16, max=>16));
-    open(DATEI, ">$rand_file");
-    print DATEI "source:$source\ntarget:$target\nusr:$to\nsubject:".@{$msg_hash->{'subject'}}[0]."\nmessage:".@{$msg_hash->{'message'}}[0]."\n";
-    close DATEI;
+    my ($rand_fh, $rand_file) = tempfile( SUFFIX => '.goto_notify');
+    print $rand_fh "source:$source\ntarget:$target\nusr:$to\nsubject:".@{$msg_hash->{'subject'}}[0]."\nmessage:".@{$msg_hash->{'message'}}[0]."\n";
+    close $rand_fh;
 
     my $feedback = system("/usr/bin/goto-notify user-message '$to' '$subject' '$message' '$rand_file' &" );