In trying to develop a simple perl CGI script, I have run into some kind 
of caching problem which is making development an absolute nightmare.

The script displays a form (using WWW::Form). On submition, it calls 
itself. If all the fields have been filled out correctly then the user 
gets redirected to an appropriate page. If the user has made errors the 
the form will be displayed again with the error messages.

The problem arises when I am using a subroutine. Whilst developing the 
subroutine, I (obviously) make errors in the code! I try the script out in 
the browser and get an error message, as you would expect. So then I 
revert the code back to what it was when it was working... try it in the 
browser again just to check, and I get an error message once again... 
strange, I just reverted the code back to what it was when I knew it was 
working.!

Sometimes, if I click refresh several times, it may suddenly decide to 
start working again. I can force it to work properly again by renaming the 
subroutine! Another way I can force it to start working again is to 
restart apache!

When the code is in such a state that I know for a fact it should be 
working, and the browser is giveing me an error... I can run the script 
successfully from the command line!!!

I also notice that if I fill out the form, purposefully making an error 
(just to test it) I get the error message as you would expect. But then 
when I correct the error and resubmit the form, I still get the error 
message. Again, if I resubmit the form several times (sometimes as many as 
20 times) it will eventually send the form with the corrected data, and 
the validation passes. And similarly, if I stop and start apache and then 
resubmit the form the new data will be passed back and validation will 
pass.

I thought this must be to do with browser caching... As, on submission, 
the browser seems to send the form back to the server with the old values 
in it. But surely, even If the browser has cached the page, when I alter 
the value in one of the input boxes it shouldn't send back the form with 
the old data!!! Thats crazy.

I have tried sending all sorts of headers to the browser to stop it 
caching the page but nothing has made a difference. So perhaps the problem 
is not in the browser, but in apache somewhere??

anyone ever had this (or a similar) problem????!!

-- 
Tom David Kirkpatrick
Virus Bulletin Web Developer, Virus Bulletin

Tel: +44 1235 555139
Web: www.virusbtn.com


-- 
To unsubscribe, e-mail: [EMAIL PROTECTED]
For additional commands, e-mail: [EMAIL PROTECTED]
<http://learn.perl.org/> <http://learn.perl.org/first-response>


Reply via email to