mod perl , windows/apache problem

2003-07-28 Thread Erik Browaldh
Hello everyone!

I have written a program that takes argument from html-formula and read and
write it to a textfile.
When I tried it with perl mod 2, under windows with
apache it doesnt work anymore.
No new entries are written to the log-file.txt
Ive tried chmod, especially r/w accesses
but that doesnt seem to help.
also, .cgi files is renamed as .pl and the first line #!/usr/bin/perl -w
is deleted.
Maybe some configurations are wrong?
More comments are followed in the code below.
Under Linux, Apache this program works
Greatful for helps
Erik


alarm(30);
$POST_MAX=5000;
use CGI::Carp qw(fatalsToBrowser);
use CGI':standard';
use POSIX 'strftime';
($Second, $Minute, $Hour, $Day, $Month, $Year, $WeekDay, $DayOfYear, 
$IsDST) = localtime(time);

#get name and message from HTML-formular
$l_name=param('by'); # name
$l_mess=param('mess'); # message
if ($l_name eq ""){ #nothing written in HTML-formula?
}
else{ #otherwise write name and message last in file
#(file path is: >log-file.txt" || die "cant open T for write $!";
flock T,2; # write lock
print T $l_name . "\n"; #concat: 
close T;
}
print "Content-Type:text/html\n\n";

#reading from same file (ie C:/WEB/Apache/projects/perl)
open (T,"){
  $tagdata=$tagdata . $row;#all txt-data inlst i en variabel!
}
close T;
@tuples=split(/\n/,$tagdata);# split w.r.t  
$name4=$tuples[0]; #I just want to save the last 4 messages in the file
$name3=$tuples[1];
$name2=$tuples[2];
$name1=$tuples[3];
$tmp_nam=$tuples[4];



if($l_name eq ""){ #IF nothing is written in the HTML-formula, THEN
$name4=$tuples[0]; #take old information
$name3=$tuples[1];
$name2=$tuples[2];
$name1=$tuples[3];
}
else{  #else "move up" information (ie only saving last 4 entries)
  $name4=$name3;
  $name3=$name2;
  $name2=$name1;
  $name1=$tmp_nam;
}
# for html-document in the same directory as perl-script, I now had to set
#the whole path, which wasnt necessary under Linux/Apache.
open (F,"){
  $row=~s//eval$1/eg; #substitution in html-doc
  print $row;
}
close F;
#this file also lies under C:/WEB/Apache/projects/perl
open T,">log-file.txt" || die "cant open T for write $!";
flock T,2; # skrivls
print T $name4 . "\n";
print T $name3 . "\n";
print T $name2 . "\n";
print T $name1 . "\n";
close T;



problems with Perl under windows, apache

2003-07-21 Thread Erik Browaldh
Hello!

I have a script under windows with apache that doesnt seems to work. The 
script is reading a log-file
and writing new information. But when trying it over internet, my skript 
does not
do any changes to the log-file. (ie its only replacing the last entry 
instead of increasing the list)

By now I have to say that when trying my script under unix, apache as 
localhost, the script is working
perfectly.

Perhaps these may be clues...:
the perl-skript is executed under: C:/WEB/Apache//perl/log.pl (the 
logfile is r/w from this DIR aswell)
chmod is already set for more users.
and Im using file-lock when reading the file and later on writing in it.
I use a refresh-function, called every 5th min.
use POSIX 'strftime';
$delay = 300;

..
print "Refresh: ", $delay, "\n";

Maybe the cache is used for updating the log-file instead of taking 
updates from the html-formula?
but why and how do I change that?

any configurationhelp or hints are welcome!
Erik