I have a question regarding use of a package's DATA filehandle under mod_perl.
I keep bits of HTML in the __DATA__ area of my modules to keep them uncluttered. I
began to notice that for a module loaded at server startup and kept alive (because it
was a content handler), I had no problems reading DATA and keeping the data. However,
objects created and destroyed with each request showed erratic behavior; after a few
successful reads from DATA, it began to fail.
I figured that it reads DATA in the first child process, but fails in the second and
thereafter because the file pointer is at the end of __DATA__. I worked around this
by storing DATA's position in a package-level global variable:
$pos = tell DATA unless $pos;
{ local $/; seek DATA, $pos, 0; $data = <DATA>; }
Is my analysis correct and is there a better solution?
Elizabeth Cortell
Web Developer
Rotary International
[EMAIL PROTECTED]
847-866-3261
--
Report problems: http://perl.apache.org/bugs/
Mail list info: http://perl.apache.org/maillist/modperl.html
List etiquette: http://perl.apache.org/maillist/email-etiquette.html