Howdy,
I am running mod_perl and have created a handler that serves all the
pages for our intranet. In this handler I load perl programs from file into
a string and run eval on the string (not in a block). The problem is that
for any session the code doesn't work the first or second time, then it
works fine. Is this a caching issue or compile-time vs. run-time issues? I
am sure this is a simple fix. What am I missing?
Here is the nasty part (don't throw stones :) So that we can
develop, I put the eval in a loop that tries it until it returns true or
runs 3 times. I can't obviously leave it this way. Any suggestions? Here
is the relevant chunk of code:
# Expect perl code. Run an eval on the code and execute it.
my $evalcode = "";
my $line = "";
open (EVALFILE, $build{"$nkey"});
while ($line = <EVALFILE>) {
$evalcode .= $line;
}
my $evalresult = 0;
my $counter=0;
#################################################################
# Temporary measure to overcome caching issue, try to
#
# run the eval code 3 times to get a true return.
#
#################################################################
until (($evalresult) || ($counter eq 3)) {
$evalresult = eval $evalcode;
$counter++;
}
$pageHash{"Retries"} = $counter if $counter > 1;
$r->print($@) if $@;
close (EVALFILE);
I appreciate any and all constructive comments.
---------------------------------------------------------------------
To unsubscribe, e-mail: [EMAIL PROTECTED]
For additional commands, e-mail: [EMAIL PROTECTED]