To LUGNET HomepageTo LUGNET News HomepageTo LUGNET Guide Homepage
 Help on Searching
 
Post new message to lugnet.off-topic.geekOpen lugnet.off-topic.geek in your NNTP NewsreaderTo LUGNET News Traffic PageSign In (Members)
 Off-Topic / Geek / 49
48  |  50
Subject: 
Re: flock() and <FH> in Perl
Newsgroups: 
lugnet.off-topic.geek
Date: 
Mon, 24 May 1999 01:30:42 GMT
Viewed: 
116 times
  
In lugnet.off-topic.geek, jsproat@geocities.com (Sproaticus) writes:
Probably a dumb question, but I can't find the answer at the moment...

I *think* I read somewhere that a flock()'ed file handle, e.g. FH,
shouldn't be accessed using the <FH> operator. Is this something to
worry about?

That doesn't sound right.  You should be able to read a file using <FH>
whether you've flocked it with LOCK_SH or LOCK_EX.  Do you remember where
you might've heard that, or whether it might've been an OS-specific warning?


Also, can I use a FileHandle object in a call to flock()?

Hmm...what's a FileHandle object?  Do you mean an IO::File object?

If so, then  ===>  "Use the Source, Luke!"

I think the answer should be "yes" because the IO::Handle::new constructor
(in the superclass of IO::File) calls Symbol::gensym() to generate an
anonymous typeglob which, according to 'perldoc Symbol', can be used as a
file or directory handle.  This makes sense intuitively, too, because an
IO::File object is just a subclass of an IO::Handle object, which is really
nothing more than a tied typeglob, and typeglobs are how perl typically
manipulates filehandles.

HTH,
--Todd



Message is in Reply To:
  flock() and <FH> in Perl
 
Probably a dumb question, but I can't find the answer at the moment... I *think* I read somewhere that a flock()'ed file handle, e.g. FH, shouldn't be accessed using the <FH> operator. Is this something to worry about? Also, can I use a FileHandle (...) (26 years ago, 20-May-99, to lugnet.off-topic.geek)

2 Messages in This Thread:

Entire Thread on One Page:
Nested:  All | Brief | Compact | Dots
Linear:  All | Brief | Compact
    

Custom Search

©2005 LUGNET. All rights reserved. - hosted by steinbruch.info GbR