Solved (very odd!?) was: Losing a file handle in perl
John Macdonald
john-Z7w/En0MP3xWk0Htik3J/w at public.gmane.org
Tue Dec 14 18:13:55 UTC 2004
On Tue, Dec 14, 2004 at 09:40:10AM -0500, Lennart Sorensen wrote:
> On Tue, Dec 14, 2004 at 09:33:21AM -0500, Madison Kelly wrote:
> > Ah, I think I am using mod_perl (almost certaily am) so that might
> > explain it. The odd thing is though that in this case '$tspace' has
> > never been given a value (or at least not in months). Would this still
> > explain why an open file handle fails and the source of what is
> > displayed is for something else? Thanks for the insight!
>
> Quite possible yes. After all mod_perl doesn't even try to initialize
> memory, so if you don't initialize ALL variables yourself at the start
> of the script, or at least write a value to them before you try to read
> from them, you are asking for trouble. Who knows what was in that
> memory before you got it. Often you might get memory that is zeroed,
> but not always. So sometimes you get lucky, sometimes you don't.
Perl does initialize all variables when they are first created.
So, you won't have random content from when the variable
storage is obtained. But, you still could have the contents
for 5 months ago if the mod_perl has been running that long
and this variable hasn't been changed in that time and it is
not reallocated on use (i.e. a global variable or a private
variable in the top level main package that neve exits after
completing an invokation).
--
--
The Toronto Linux Users Group. Meetings: http://tlug.ss.org
TLUG requests: Linux topics, No HTML, wrap text below 80 columns
How to UNSUBSCRIBE: http://tlug.ss.org/subscribe.shtml
More information about the Legacy
mailing list