Index: app/src/compiledic/compiledic
===================================================================
--- app/src/compiledic/compiledic	(revision 20b4e44e7537762f6aceb72b039f6e8f8a50e201)
+++ app/src/compiledic/compiledic	(revision 389de9abcbd0bbec63c04912b2d253b58dc5145c)
@@ -11,4 +11,5 @@
 use File::Basename;
 use File::Temp;
+use File::Copy;
 use Getopt::Long;
 
@@ -51,27 +52,28 @@
 `lexmakelab $symfilenoext`;
 
-# Analiza pliku s³ownika
+# Tworzymy katalog tymczasowy, gdzie wszystko bedzie umieszczane.
+$tmp_root = tempdir( CLEANUP => 1 );
 
-print "preparing file...........................................";
 
-`sed -r "s/([[:punct:]])/\[\\1\]/g" < $file > temp1`;
+# Analiza pliku slownika
 
-`cp temp1 temp2`;
+print "preparing file...........................................\n";
+print "... sed section .....\n";
+(undef, my $file_sed) = File::Temp::tempfile( DIR => $tmp_root, SUFFIX => ".sed" );
+`sed -r "s/([[:punct:]])/\[\\1\]/g" < $file > $file_sed`;
 
 print "OK\n";
 
-#dzielimy plik na wiele czê¶ci, uruchamiamy lexcomplex dla ka¿dej
-#czê¶ci osobno, nastêpnie ³±czymy to za pomoc± programu fsmunion
+#dzielimy plik na wiele czesci, uruchamiamy lexcomplex dla kazdej
+#czesci osobno, nastepnie laczymy to za pomoca programu fsmunion
 
-#print "Dzielê s³ownik na mniejsze czê¶ci...";
+#print "Dziele slownik na mniejsze czesci...";
 
-open(IN, "./temp2");
+open(IN, $file_sed);
 
 $lineCount = 0;
 $fileCount = 0;
 
-`mkdir LemTEMP`;
-
-open(FILE, ">LemTEMP/slo_0");
+open(FILE, ">$tmp_root/slo_$fileCount");
 
 while (<IN>) {
@@ -82,6 +84,6 @@
 
 	close(FILE);
-#	print "Tworzê nowy plik tymczasowy: slo_".$fileCount."\n";
-	open(FILE, ">LemTEMP/slo_".$fileCount);
+#	print "Tworze nowy plik tymczasowy: slo_".$fileCount."\n";
+	open(FILE, ">$tmp_root/slo_".$fileCount);
     }
 
@@ -107,7 +109,5 @@
     $files++;
 
-    $command = "lexcomplex -l $labfile -S $sclfile < LemTEMP/slo_".$i." > LemTEMP/slownik_".$i.".fsm";
-
-    `$command`;
+    `lexcomplex -l $labfile -S $sclfile < $tmp_root/slo_$i > $tmp_root/slownik_$i.fsm`;
 
 }
@@ -120,5 +120,5 @@
 print "OK\n";
 
-`rm LemTEMP/slo_*`;
+unlink <$tmp_root/slo_*>;
 
 print "building final automaton";
@@ -130,5 +130,5 @@
 $dots=0;
 
-`cp LemTEMP/slownik_0.fsm slownik1.fsm`;
+copy("$tmp_root/slownik_0.fsm", "$tmp_root/slownik1.fsm");
 
 for ($i=1; $i<=$filecount; $i++) {
@@ -141,9 +141,7 @@
     $files++;
 
-    $command = "fsmunion LemTEMP/slownik_".$i." slownik1.fsm > slownik2.fsm";
+    `fsmunion $tmp_root/slownik_$i slownik1.fsm > $tmp_file/slownik2.fsm`;
 
-    `$command`;
-
-    `mv slownik2.fsm slownik1.fsm`;
+    move("$tmp_root/slownik2.fsm", "$tmp_root/slownik1.fsm") || die "Unable to move $tmp_root/slownik2.fsm!\n";
 }
 
@@ -154,5 +152,5 @@
 }
 
-`fsmunion LemTEMP/* > slownik1.fsm`;
+`fsmunion $tmp_root/* > $tmp_root/slownik1.fsm`;
 
 print "OK\n";
@@ -160,7 +158,7 @@
 print "removing epsilon-transitions.............................";
 
-`fsmrmepsilon slownik1.fsm > slownik2.fsm`;
+`fsmrmepsilon $tmp_root/slownik1.fsm > $tmp_root/slownik2.fsm`;
 
-`rm slownik1.fsm`;
+unlink ("$tmp_root/slownik1.fsm");
 
 print "OK\n";
@@ -168,7 +166,7 @@
 print "determinizing automaton..................................";
 
-`fsmdeterminize slownik2.fsm > slownik1.fsm`;
+`fsmdeterminize $tmp_root/slownik2.fsm > $tmp_root/slownik1.fsm`;
 
-`rm slownik2.fsm`;
+unlink ("$tmp_root/slownik2.fsm");
 
 print "OK\n";
@@ -176,5 +174,5 @@
 print "minimizing automaton.....................................";
 
-`fsmminimize slownik1.fsm > slownik.fsm`;
+`fsmminimize $tmp_root/slownik1.fsm > $tmp_root/slownik.fsm`;
 
 #`rm slownik1.fsm`;
@@ -184,9 +182,9 @@
 print "converting fsm format to bin.............................";
 
-`fsmprint -i $labfile slownik.fsm > slownik.txt`;
+`fsmprint -i $labfile $tmp_root/slownik.fsm > $tmp_root/slownik.txt`;
 
-`fsm2aut slownik.txt > slownik.aut`;
+`fsm2aut $tmp_root/slownik.txt > $tmp_root/slownik.aut`;
 
-`aut2fsa < slownik.aut > $filenameprefix.bin`;
+`aut2fsa < $tmp_root/slownik.aut > $filenameprefix.bin`;
 
 print "OK\n";
@@ -194,11 +192,6 @@
 print "removing temporary files.................................";
 
-`rm LemTEMP/*`;
-`rmdir LemTEMP`;
-`rm temp2`;
-`rm slownik.fsm`;
-`rm slownik.txt`;
-`rm slownik.aut`;
-`rm labels.*`;
+unlink <$tmp_root/*>;
+unlink ($tmp_root);
 
 print "OK\n";
Index: app/src/ser/ser
===================================================================
--- app/src/ser/ser	(revision 20b4e44e7537762f6aceb72b039f6e8f8a50e201)
+++ app/src/ser/ser	(revision 389de9abcbd0bbec63c04912b2d253b58dc5145c)
@@ -156,9 +156,8 @@
 
 
-system "m4 \"--define=PATTERN=$flexpattern\" \"--define=DEFAULTACTION=$defaultaction\" $flextemplate > $tmpfile_l";
+`m4 "--define=PATTERN=$flexpattern" "--define=DEFAULTACTION=$defaultaction" $flextemplate > $tmpfile_l`;
 
 if($flex)
 {
-	#system "cat $tmpfile_l";
 	if(open(FLEX, $tmpfile_l)) {
 		while(<FLEX>) {
@@ -173,11 +172,9 @@
 }
 
-system "flex -o$tmpfile_c $tmpfile_l";
-system "cc -O3 -o $tmpfile_x $tmpfile_c -lfl";
-system "$tmpfile_x";
+`flex -o$tmpfile_c $tmpfile_l`;
+`cc -O3 -o $tmpfile_x $tmpfile_c -lfl`;
+`$tmpfile_x`;
 
-#system "rm -f $tmpfile_l $tmpfile_c $tmpfile_x";
 unlink $tmpfile_l;
 unlink $tmpfile_c;
 unlink $tmpfile_x;
-
