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

Long time programmer, noob at Perl, though. I'm using mod_perl and apache to parse directories within my webserver. Now, the directory I want to check contents gets passed to the script as an URL parameter. Something like parse.pl?dir=something/somethingElse. This in turn is given to opendir to get a handle, then readdir to read the contents.

Now here's the problem. The first time I load the script, it works like a charm, but since ModPerl::Registry seems to keep the script in memory, changing the parameter (for example say to ?dir=anotherDir) does not change the results of the search (apparently they get cached somewhere). Forcing a hard reload on the browser (ctrl+F5) returns the correct results, but as you can see this is less than desirable.

I've tried using ModPerl::PerlRun. This works alright, but I hear it's inefficient, plus it spams the error log with warning messages about some constants being redefined in Utils.pm (?!)

So, any way I can tell Perl that I want readdir to get new results each time, instead of reading the cache?

Replies are listed 'Best First'.
Re: ModPerl::Registry and readdir
by Anonymous Monk on Aug 13, 2012 at 08:33 UTC

      Oh wow. That helps a lot. I don't know how I missed that. I swear I read the mod_perl documentation up and down thrice.

      Thanks a lot :D