This seemed to hit it on the head, i really dont understand WHY this makes a
difference in modperl and not nonmoperl services?

I changed the count variable $i = 1 to my $i = 1 and the $msgnum to my
$msgnum and it is working like the non modperl server does. Correctly.

Isnt there a way to clear global variable to a null after a web transaction
is complete?

Thanks for the tip.

John

> You might want to try declaring the file handles as LOCAL *myfile or
> whatever. You have to be very careful about making global variables with
> modperl since they have the benfit of sticking around after the web
> transaction is complete.
>
> ryan
>
> ----- Original Message -----
> From: "John Buwa" <[EMAIL PROTECTED]>
> To: <[EMAIL PROTECTED]>
> Sent: Tuesday, July 31, 2001 5:26 AM
> Subject: More stuff not working with conversion to modperl?
>
>
> Hello,
>
> I am trying to finish up my scripts conversion to mod perl and here is a
> routine i truely do not undestand why it is not working. This is the same
> code that is running on both the modperl i am useing to port scripts and
> test and the live non-modperl apache, which works fine:
>
> This is a routine that deletes a line from a mail file stored in this
> format:
>
> |user|date|time|message|status|
>
> If the file is say 20 lines and i am removing line 5, defined by $msgnum,
it
> is suposed to remove only line 5 and print the rest back to the users mail
> file. The same code on the production machine works fine. I have
experienced
> some really strange behavior of which none is correct on the modperl.
Either
> it will remove multiple lines from the mail file along with the line it
was
> suposed to OR it will remove the entire mail file and sometime later a
> portion of the mail file will re-apear garbled? Could this possibly have
> something to do with the flock files? I am using:
>
> use Fcntl ':flock'; # import LOCK_* constants
>
> in all my scripts, is this still valid in modperl servers?
>
> if (($user_matched == 1) && ($pass_matched == 1)) {
>                 $i = 1; #init count variable
>                 open(MYFILE, "mail/$user"); #open users mail box to read
in
>                 @OLDMAIL = <MYFILE>;
>                 close(MYFILE);
>                 open(NEW, ">mail/$user"); #open new copy of users mail box
>                 flock (NEW, LOCK_SH);
>                 seek (NEW, 0, 0);     # Rewind
>                 foreach $line (@OLDMAIL) {
>                         chomp($line);
>                         unless ($i == $msgnum) {
>                                 print NEW "$line\n";
>                                                             }
>                                 $i++ #increment cnt
>                                                        }#End of foreach
loop
>                 flock (NEW, LOCK_UN);#release flock
>                 close(NEW);#close new mail file
>
>  }#end of it
>
>
>
>

Reply via email to