On Thu, Jul 03, 2003 at 02:51:23PM -0400, Perrin Harkins wrote:
> On Thu, 2003-07-03 at 13:38, Peter Ensch wrote:
> > 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});
> > }
>
> That's confusing code. Your users.dat file is a chunk of code that
> returns a value that you use? A little obscure, in my opinion. And
> what's that stuff with the ref/de-ref syntax for?
The file contains a simple hash ref. like
{
duck => 'quack',
dog => 'woof',
cat => 'meow',
}
The ref/de-ref was a mistake; a hold over from when USERS was a
constant (and which didn't interpolate in a require). Now it's
$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.
>
> The file is up-to-date, or the param 'users' is?
>
The file is. IE. it gets written and and the new stuff is available
by simply reloading the page.
> Why don't you debug it a little by putting a warn statement in your
> users.dat file that prints the process ID? Then you can tell if it is
> truly being executed more than once by the same process.
>
Hmm. Not sure how to do that w/out messing w/ the headers and
making the app. crash. How would I do that?
P
--
^~^~^~^~^~^~^~^~^~^~^~^~^~^~^~^~^~^~^~^~^~^~^~^
Peter Ensch,
[EMAIL PROTECTED] A-1140 (214) 480 2333
^~^~^~^~^~^~^~^~^~^~^~^~^~^~^~^~^~^~^~^~^~^~^~^