Hallöle!
Ich habe den folgenden Code:
{
local(*FD);
sub lockSection {
my($self, $lockFile) = @_;
my($rc);
return(0) if ( ! $lockFile );
open(FD, ">", $lockFile) or return(0);
$lockHandles{$lockFile} = FD if ( ($rc=flock(FD, LOCK_EX | LOCK_NB)) );
return($rc);
}
}
und bekomme bei Verwendung von "use strict;" die Fehlermeldung:
Bareword "FD" not allowed while "strict subs" in use at BHFTools.pm line 182.
Compilation failed in require at ./BTtestLock.pl line 3.
BEGIN failed--compilation aborted at ./BTtestLock.pl line 3.
Zeile 182 ist
$lockHandles{$lockFile} = FD if ( ($rc=flock(FD, LOCK_EX | LOCK_NB)) );
des Moduls BHFTool.pm und Zeile 3 ist
des Test-Programms.
Ohne "use strict;" läuft der Code korrekt.
Was mache ich falsch?
Gruß, Doc
P.S. FD muss ich mir merken, weil ich später beim unlock ein close(FD) ausführen muss.