in reply to Re: mod_perl and cache?
in thread mod_perl and cache?

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)

Replies are listed 'Best First'.
Re^3: mod_perl and cache?
by Aristotle (Chancellor) on Mar 03, 2003 at 05:01 UTC

    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.

      I've been doing some more experements... and found something odd... it seems that apache itself may be caching it and sending it out... or at least the subs that IT calls.

      I've added some output commands to certain functions, and it seems they are not always being called, even though, by rights, they should be. I'm uploading my current code to my scratchpad, take a look at the sub 'calendar' if you would... it has code that should output the current value. Yet when the month I request is '5', and it is showing '9' in my browser, the text file also shows September. Yet the arguments I have it print out show '5', and if I hit refresh after 5 minutes, it shows up as may, and the text file updates.





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

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

        Your problem is that you are creating closures in your script. These are not a big problem under CGI because the interpreter exits every time, but under Apache::Registry you have to follow better progamming practices.

        Look at your login sub. You use the variable %ARGS in it, but don't pass it to the sub. You are taking advantage of the fact that %ARGS is declared in a higher scope and is thus visible to your subroutine. However, after the first time this gets executed the %ARGS used in the login sub is private and will no longer change.

        To fix this, you need to explicitly pass all variables to your subs. Instead of saying &login, say login(\%ARGS) and then read that in at the beginning of the login sub. This is a good programming practice, and you should be doing it anyway.

        Note that all of this is explained in the documents that merlyn pointed out to you in the very first post in this thread. You can also read about it in the mod_perl guide.

        As I said, I'm afraid I'm stumped.. I've done a bunch of CGI programming but not any mod_perl work yet (I'll get around to it one day, I swear..). Maybe one of our resident mod_perl druids can help if you repost this question as a new SOPW?

        Makeshifts last the longest.