You are viewing a plain text version of this content. The canonical link for it is here.
Posted to modperl@perl.apache.org by to...@virusbtn.com on 2005/04/26 18:40:58 UTC
caching problem?
In trying to develop a simple perl script, I have run into some kind of
caching problem which is making development an absolute nightmare.
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 gives me an error... I can run the script
successfully from the command line!!!
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
Re: caching problem?
Posted by Perrin Harkins <pe...@elem.com>.
On Tue, 2005-04-26 at 17:40 +0100, tom.kirkpatrick@virusbtn.com wrote:
> 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!
Modules don't get reloaded automatically unless you use something like
Apache::Reload. Apache::Registry scripts do get reloaded. You haven't
told us anything about how you are developing (Registry? Perl handlers?
Mason?) or even which version of mod_perl you have, so it's hard to give
you specific advice. There is a lot of documentation on transitioning
from CGI programming to mod_perl in the on-line docs:
http://perl.apache.org/
- Perrin
Re: caching problem?
Posted by Tom Schindl <to...@gmx.at>.
-----BEGIN PGP SIGNED MESSAGE-----
Hash: SHA1
tom.kirkpatrick@virusbtn.com schrieb:
| In trying to develop a simple perl script, I have run into some kind of
| caching problem which is making development an absolute nightmare.
|
| 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 gives me an error... I can run the script
| successfully from the command line!!!
|
| anyone ever had this (or a similar) problem????!!
|
That's not a problem its more a feature of mod-perl. Don't forget the
code you write gets compiled only once per-apache-process/thread.
The following happens:
apache_ctl restart
1. request
=> handled by apache-child 1
=> (no code loaded) compile code (code_1)
=> execute code
=> produces an error
revoke changes
2. request
=> handled by apache-child 1
=> execute code
=> produces an error
3. request
=> handled by apache-child 2
=> (no code loaded) compile code (code_1)
=> execute code
=> successful
In short child1 and child2 have different versions of code and won't
recompile until you say them to do so.
2 ways out:
- -----------
- - always restart apache when files changed
- - use Apache::Reload/Apache2::Reload
Tom
-----BEGIN PGP SIGNATURE-----
Version: GnuPG v1.4.0 (GNU/Linux)
Comment: Using GnuPG with Thunderbird - http://enigmail.mozdev.org
iD8DBQFCbnPokVPeOFLgZFIRAj0rAJ9l7rCYzXmQSTb4Zq/sBnPoVuFAyACfSZ2K
DXiphq+FU958J3Zf32Er4l8=
=p5kr
-----END PGP SIGNATURE-----