On Mon, Jun 30, 2003 at 05:28:43PM -0400, Perrin Harkins wrote:
> On Sat, 2003-06-28 at 15:08, Peter B. Ensch wrote:
> > Coding in plain CGI I've often require'd files containing
> > data in perl data-structures. The script may write to the
> > file (via Data::Dumper for example) allowing subsequent
> > invokations of the script to have access to the revised
> > data.
>
> It would be simpler and faster to use MLDBM::Sync for this.
>
Not familiar w/ this module and it's not on our system; I'll
certainly look into it.
> > I was expecting this methodology to break under mod_perl
> > thinking that the require would only happen once (the
> > first time the script runs after server startup); however,
> > it seems to be working the way it always did.
> >
> > Why is this? Am I missing something?
>
> Can't tell without seeing some code. Your require'd files with not be
> reloaded unless you are using Apache::Reload or Apache::StatINC to force
> them.
>
I'm NOT using A::Reload or A::StatINC. My script appears to be
require'ing the data file on each user transaction, just like
under plain CGI.
I'm using CGI::Application and this part of the code happens inside
the cgiapp_init() method which I'm overriding:
our $USERS : unique = "/path/to/users.dat";
sub cgiapp_init {
my $self = shift;
$self->param('users' => require ${\$USERS});
}
So, to reiterate, I may write to users.dat on one transaction
and read on another; the file contents is always up-to-date.
I still can't understand why this is because I did not think
it would be reloaded unless the server was restarted.
BTW - it doesn't have anything to do with the 'unique' our
attribute; same behavour with or without.
I'm new to apache and I'm not running in single-process mode;
this shouldn't have a bearing should it?
Thanks,
P
--
^~^~^~^~^~^~^~^~^~^~^~^~^~^~^~^~^~^~^~^~^~^~^~^
Peter Ensch,
[EMAIL PROTECTED] A-1140 (214) 480 2333
^~^~^~^~^~^~^~^~^~^~^~^~^~^~^~^~^~^~^~^~^~^~^~^