Hello scripters
Requirement:
I am trying to write a perl script that manipulate a html file. Both the html file and the script are placed at central server. I have scheduled one more script in client PC to run at start-up, that calls this server script with required arguments and the HTML page is updated accordingly. This is not server client architecture but a static server script called from client PC
The problem:
The scripts I have written (Server and PC) are working fine up to the point that the HTML page is updated correctly, but some times the HTML page becomes BLANK .
I am not able to pinpoint the problem. Below is the Server script …
# The runtime argumnents must be of form : #
# labcar_name Working/locked user_id Date&time #
# or #
# Labcar_name free date&time #
# #
- use warnings;
-
use Fcntl qw(:flock);
-
use strict;
-
my $html_file ="\\\\aaa_edc_nts1\\edc_info\\Quality\\EDT\\38_EDT3\\39_Lab Eye\\webpages\\labeye_Intranet.html";
-
my $log_file = "\\\\aaa_edc_nts1\\edc_info\\Quality\\EDT\\38_EDT3\\39_Lab Eye\\webpages\\user.log";
-
-
my $SEMAPHORE = $html_file . '.lck';
-
open(S, ">$SEMAPHORE") or die "$SEMAPHORE: $!";
-
flock(S, LOCK_EX) or die "flock() failed for $SEMAPHORE: $!";
-
-
open(LOG1,">>$log_file") or die "$log_file: $!";
-
-
my $filesize = -s "$html_file";
-
-
-
print LOG1 "\n@ARGV $filesize\n";
-
-
close LOG1;
-
-
-
open (PARSED_FILE,$html_file) or die "Cannot open the file";
-
-
my @parsed_file;
-
-
# Some processing logic here depending on the arguments
-
-
-
close PARSED_FILE;
-
-
print "\n TRYING TO WRITE TO FILE";
-
open (OUTPUT_FILE,"+>$html_file") or die "Cannot open the file";
-
-
seek(OUTPUT_FILE,0,0);
-
-
print OUTPUT_FILE @parsed_file;
-
-
close OUTPUT_FILE;
-
close S;