I have a Perl CGI script that emits different HTML apparently randomly. None of the inputs change. E.g., I will run wget
twice and get two different results. The CGI is backed by a development database that, too, doesn't change.
I have a debug statement that informs me that the same number of elements are returned from the DB into the script.
Frankly, I'm mystified. Logic, DB, and inputs don't change, but the output does.
The http server is apache2 on Ubuntu 10.04. Perl version is perl 5.10.
edit: whenever I run it from the command-line on the server, the output is correct.
edit2: some of the bad runs seem like prior versions of the script. I don't think Apache is caches CGIs, but it seems like it might be grabbing out-of-date cache versions....
$[ = rand
in your code anywhere do you :) – Eric Strom