Flame has asked for the wisdom of the Perl Monks concerning the following question:

I have a cgi program I've been working on recently that suddenly seems to have stopped responding. I click on things that should change pages for example and it behaves as though I hit refresh, however when I clear the cache and go directaly to those pages, it works correctally... until I try to go to the page after that or the page I was at before...

I did not have this problem until recently, and I can't think of what might have caused it other than my switch from HTML::Mason to just a normal cgi-script. Below is what the header it is currently printing out.

200 OK Connection: close Date: Fri, 28 Feb 2003 20:56:56 GMT Pragma: no-cache Server: Apache/1.3.27 (Unix) mod_perl/1.27 Content-Type: text/html Client-Date: Fri, 28 Feb 2003 20:56:05 GMT Client-Response-Num: 1 Set-Cookie: MY_SESSION_ID=1ce2b752001b4d4619d465175a8c9746; path=/

I'm still kinda new with configuring mod_perl as well, so it occurs to me that it might have something to do with that too... so I'll include the only parts of the httpd config I've changed:

PerlModule DBI PerlModule Apache::DBI PerlModule HTML::CalendarMonthSimple PerlModule Apache::Request PerlModule Tie::IxHash PerlModule Apache::Session::MySQL PerlModule CGI::Cookie PerlModule Apache::Registry <Location /cgi-bin> SetHandler perl-script PerlHandler Apache::Registry Options ExecCGI allow from all PerlSendHeader On </Location>

I've included everything that I can think of, did I overlook something or some other possibility for what I might have changed?

Thank you for any assistance you can give.





My code doesn't have bugs, it just develops random features.

Flame ~ Lead Programmer: GMS (DOWN) | GMS (DOWN)

Replies are listed 'Best First'.
•Re: mod_perl and cache?
by merlyn (Sage) on Feb 28, 2003 at 21:29 UTC
    other than my switch from HTML::Mason to just a normal cgi-script
    Uh, which is it? mod_perl like your title says, or CGI, like the body of your message says?

    Or is it Apache::Registry, in which case we must wonder if your "cgi" "script" is compliant with the restrictions imposed by that interface, which is most definitely not a CGI interface. See the mod_perl_traps and cgi_to_mod_perl manpages.

    -- Randal L. Schwartz, Perl hacker
    Be sure to read my standard disclaimer if this is a reply.

      As I said, I'm adjusting still. So I'll answer that to the best of my ability. It's configured as was stated above. It's executing under mod_perl (sorry, I usually equate the two, still getting used to the differences as I said, starting to see them). Anyway, I'm not sure what would be incompatable, I'd include the whole script if that would help, but in general, I follow my general coding practices, use strict and 'my'.

      Anyway, since you bring up Apache::Registry, I'm not quite certain on the differences between that and the other options, but it seems closest to what I was looking for.

      The script does run, which I assume it would not do if it was really set up wrong, it just seems that browsers INSIST on caching it, which they didn't do previously.

      Is there anything in particular I should look for?

      Thanks for pointing out my conflicting signals merlyn.





      My code doesn't have bugs, it just develops random features.

      Flame ~ Lead Programmer: GMS (DOWN) | GMS (DOWN)

Re: mod_perl and cache?
by perrin (Chancellor) on Feb 28, 2003 at 22:26 UTC
    Are you sure that the problem is browser caching? Debug it using the LWP GET script to see if that's really it. If it is browser caching, it might be a result of changing the style of your URLs.
      Hmm, well switching from HTML::Mason to mod_perl renamed the file from .html to .cgi. It's always been mostly "query-string" based. When I do a manual clear of the cache, it works, until I try to go to another subpage



      My code doesn't have bugs, it just develops random features.

      Flame ~ Lead Programmer: GMS (DOWN) | GMS (DOWN)

Re: mod_perl and cache?
by Aristotle (Chancellor) on Mar 01, 2003 at 14:18 UTC

      Hmm, even that doesn't seem to be working, but when I do a manual 'delete temporary files' in IE, and enter the exact page in the location bar, it takes me where I wanted to go. This is what the header currently prints:

      200 OK Cache-Control: no-store, no-cache, must-revalidate, post-check=0, pre- +check=0 Connection: close Date: Sat, 01 Mar 2003 17:30:22 GMT Pragma: no-cache Server: Apache/1.3.27 (Unix) mod_perl/1.27 Content-Type: text/html Expires: Sat, 26 Jul 1997 05:00:00 GMT Last-Modified: Sat, 01 Mar 2003 17:30:22 GMT Client-Date: Sat, 01 Mar 2003 17:29:31 GMT Client-Response-Num: 1 Set-Cookie: MY_SESSION_ID=08618e55ac9d5ec5ca683b6723cc87ad; path=/




      My code doesn't have bugs, it just develops random features.

      Flame ~ Lead Programmer: GMS (DOWN) | GMS (DOWN)

        Have you look at your preferences? There is a setting for how often to check a cached page - set it to "Always". If that still doesn't do it, send IE to the bitbucket where it rightly belongs. (Now, if one could tell that same thing to their customers.. :-/ )

        Makeshifts last the longest.

      This is really odd, it seems to be caching only part of the page, and allowing the rest to refresh. I had the page start writing all of it's arguments at the end and those constantly update (I also had the current time display in the title, and it *usually* updated). But while those updated, the content that should have updated with them, did not.





      My code doesn't have bugs, it just develops random features.

      Flame ~ Lead Programmer: GMS (DOWN) | GMS (DOWN)

        Any sufficiently advanced technology is indistinguishable from magic.. nor does it have bugs, it just develops random features.

        By which I mean to say, I'm stumped. :)

        Makeshifts last the longest.

      Hmm, I'm not sure what to make of this... it seems apache is recieving the requests, but not executing the script. I don't know the meaning of much of what's in the server access logs, but this is an excerpt from a time when I was trying to get a change by hitting reload or the link repeatedly.

      192.168.1.10 - - [01/Mar/2003:19:06:51 -0500] "GET /cgi-bin/schedule.c +gi HTTP/1.1" 200 9757 192.168.1.10 - - [01/Mar/2003:19:06:52 -0500] "GET /school/schedule.js + HTTP/1.1" 200 283 192.168.1.10 - - [01/Mar/2003:19:06:55 -0500] "GET /cgi-bin/schedule.c +gi?action=view&viewmonth=9 HTTP/1.1" 200 9757 192.168.1.10 - - [01/Mar/2003:19:06:59 -0500] "GET /cgi-bin/schedule.c +gi?action=view&viewmonth=9 HTTP/1.1" 200 9197 192.168.1.10 - - [01/Mar/2003:19:07:08 -0500] "POST /cgi-bin/schedule. +cgi HTTP/1.1" 200 9757 192.168.1.10 - - [01/Mar/2003:19:07:15 -0500] "month=9&action=login&lo +gin=Flame&pass=****POST /cgi-bin/schedule.cgi HTTP/1.1" 200 9757 192.168.1.10 - - [01/Mar/2003:19:07:24 -0500] "month=3&action=login&lo +gin=Flame&pass=****GET /cgi-bin/schedule.cgi?action=login&login=Flame +&pass=**** HTTP/1.1" 200 9757 192.168.1.10 - - [01/Mar/2003:19:07:26 -0500] "GET /cgi-bin/schedule.c +gi?action=login&login=Flame&pass=**** HTTP/1.1" 200 9757 192.168.1.10 - - [01/Mar/2003:19:07:28 -0500] "GET /cgi-bin/schedule.c +gi?action=login&login=Flame&pass=**** HTTP/1.1" 200 9757 192.168.1.10 - - [01/Mar/2003:19:07:29 -0500] "GET /school/schedule.js + HTTP/1.1" 304 - 192.168.1.10 - - [01/Mar/2003:19:07:29 -0500] "GET /cgi-bin/schedule.c +gi?action=login&login=Flame&pass=**** HTTP/1.1" 200 9757 192.168.1.10 - - [01/Mar/2003:19:07:29 -0500] "GET /school/schedule.js + HTTP/1.1" 304 - 192.168.1.10 - - [01/Mar/2003:19:07:30 -0500] "GET /cgi-bin/schedule.c +gi?action=login&login=Flame&pass=**** HTTP/1.1" 200 9757 192.168.1.10 - - [01/Mar/2003:19:07:30 -0500] "GET /school/schedule.js + HTTP/1.1" 304 - 192.168.1.10 - - [01/Mar/2003:19:07:30 -0500] "GET /cgi-bin/schedule.c +gi?action=login&login=Flame&pass=**** HTTP/1.1" 200 9757 192.168.1.10 - - [01/Mar/2003:19:07:30 -0500] "GET /school/schedule.js + HTTP/1.1" 304 - 192.168.1.10 - - [01/Mar/2003:19:07:31 -0500] "GET /cgi-bin/schedule.c +gi?action=login&login=Flame&pass=**** HTTP/1.1" 200 9757 192.168.1.10 - - [01/Mar/2003:19:07:31 -0500] "GET /school/schedule.js + HTTP/1.1" 304 - 192.168.1.10 - - [01/Mar/2003:19:07:31 -0500] "GET /cgi-bin/schedule.c +gi?action=login&login=Flame&pass=**** HTTP/1.1" 200 9757 192.168.1.10 - - [01/Mar/2003:19:07:31 -0500] "GET /school/schedule.js + HTTP/1.1" 304 - 192.168.1.10 - - [01/Mar/2003:19:07:31 -0500] "GET /cgi-bin/schedule.c +gi?action=login&login=Flame&pass=**** HTTP/1.1" 200 9757 192.168.1.10 - - [01/Mar/2003:19:07:31 -0500] "GET /school/schedule.js + HTTP/1.1" 304 - 192.168.1.10 - - [01/Mar/2003:19:07:31 -0500] "GET /cgi-bin/schedule.c +gi?action=login&login=Flame&pass=**** HTTP/1.1" 200 9757 192.168.1.10 - - [01/Mar/2003:19:07:31 -0500] "GET /school/schedule.js + HTTP/1.1" 304 - 192.168.1.10 - - [01/Mar/2003:19:07:31 -0500] "GET /cgi-bin/schedule.c +gi?action=login&login=Flame&pass=**** HTTP/1.1" 200 9757 192.168.1.10 - - [01/Mar/2003:19:07:31 -0500] "GET /school/schedule.js + HTTP/1.1" 304 - 192.168.1.10 - - [01/Mar/2003:19:07:32 -0500] "GET /cgi-bin/schedule.c +gi?action=login&login=Flame&pass=**** HTTP/1.1" 200 9757 192.168.1.10 - - [01/Mar/2003:19:07:32 -0500] "GET /school/schedule.js + HTTP/1.1" 304 - 192.168.1.10 - - [01/Mar/2003:19:07:32 -0500] "GET /cgi-bin/schedule.c +gi?action=login&login=Flame&pass=**** HTTP/1.1" 200 9757 192.168.1.10 - - [01/Mar/2003:19:07:32 -0500] "GET /school/schedule.js + HTTP/1.1" 304 - 192.168.1.10 - - [01/Mar/2003:19:07:32 -0500] "GET /cgi-bin/schedule.c +gi?action=login&login=Flame&pass=**** HTTP/1.1" 200 9757 192.168.1.10 - - [01/Mar/2003:19:07:32 -0500] "GET /school/schedule.js + HTTP/1.1" 304 - 192.168.1.10 - - [01/Mar/2003:19:07:32 -0500] "GET /cgi-bin/schedule.c +gi?action=login&login=Flame&pass=**** HTTP/1.1" 200 9757 192.168.1.10 - - [01/Mar/2003:19:07:32 -0500] "GET /school/schedule.js + HTTP/1.1" 304 - 192.168.1.10 - - [01/Mar/2003:19:07:34 -0500] "GET /cgi-bin/schedule.c +gi?action=login&login=Flame&pass=**** HTTP/1.1" 200 9757




      My code doesn't have bugs, it just develops random features.

      Flame ~ Lead Programmer: GMS (DOWN) | GMS (DOWN)

        Try adding a warn "Feh!" or something to the script to see if it actually isn't run. The logs say Apache is sending 9757 bytes back to the client, anyway. Is there anything related in the error log?

        Makeshifts last the longest.