No :-)
This code is fine for what it does:
open # open a file for read or write ( ORDERFILE # onto a FILEHANDLE called ORDERFILE , " > # > means write to the file, create if does not exist # Note all previous content will be deleted # if this file exists >> means append to the end $outfile # full or relative path to file " ) or # if the open works it returns true so we never do the next + bit diehtml() # print an error message
You don't wanna touch anything in the demon code. It was for illustrative purposes and is not relevant to your problem provided you are happy that the code you have worked just replace the lockfile code.
In this code:
$fh = "ORDERFILE"; sysopen($fh, "$outfile", O_CREAT | O_EXCL | O_RDWR, 0600) or diehtml("Can't open order records: $!\n");
You don't need to set $fh to a string. It will just get overwritten in the open. A FILEHANDLE is a type of perl internal object (like a scalar) and the reference to it is held in the $fh var. To illustrate the syntax:
open $fh, ">$file" or die "Can't write $file $!\n"; print $fh "here is some data\n"; close $fh;
Same with sysopen but I can't be bothered to type that much.
cheers
tachyon
s&&rsenoyhcatreve&&&s&n.+t&"$'$`$\"$\&"&ee&&y&srve&&d&&print
In reply to Re: Re: Re: Perl script crashing at lockfile ?
by tachyon
in thread Perl script crashing at lockfile ?
by peterr
| For: | Use: | ||
| & | & | ||
| < | < | ||
| > | > | ||
| [ | [ | ||
| ] | ] |