I have some problem about file handle in mod_perlV2.02 +
apache v2.055. I got some strange result today.And i check the program
find that i forgot to close(filehande).
But this case to bring about some guestion! Will
the code influence each other? When
muti-user visit the same recourse at the same
time?
One clint at A and another in B.
Q1.How to avoid this situation??
Need i lock file when i reading file??
Q2.what is difference between FLOCK_SH and FLOCK_EX
?
#!/usr/bin/perl
sub main{
....
print Header(); #print http header
....
my var1='';
open(H,"/usr/local/my_setup");
while (<H>){
$ var1.=$_;
#<=======A
}
close(H);
my $var2;
open(H,"/usr/local/my_page");
while (<H>){
$ var2.=$_; #<=======B
}
close(H); $var2=~s/SomeText/$var1/igs;
print $var2;
return;
}
main();
1;
|
- File handle in mod_perl LUKE
- Re: File handle in mod_perl Tom Schindl
- Re: File handle in mod_perl Perrin Harkins