in reply to Need object to retain open filehandle.

i have no problem with getting your code to work. but i used a plain file to read from. are you trying to read from a device? i wonder whether sysopen is the right method to do so.

--------------------------------
masses are the opiate for religion.
  • Comment on Re: Need object to retain open filehandle.

Replies are listed 'Best First'.
Re^2: Need object to retain open filehandle.
by exodist (Monk) on Jul 02, 2007 at 04:19 UTC

    Figured out the problem. It had nothing to do with my object. I am using threads in my main script, the problem is when I turn my object into a shared object.

      I am using threads in my main script, the problem is when I turn my object into a shared object.

      How are you "turning the object into a shared object"?

      In general, this doesn't work.


      Examine what is said, not who speaks -- Silence betokens consent -- Love the truth but pardon error.
      "Science is about questioning the status quo. Questioning authority".
      In the absence of evidence, opinion is indistinguishable from prejudice.
Re^2: Need object to retain open filehandle.
by exodist (Monk) on Jul 02, 2007 at 03:49 UTC

    Yes, I am using a device, a hard drive specifically. Strange that it worked for you, I did my own test to see if it was a problem with the functions, the storing of the file handle, or somewhere else. Basically I did a sysseek and sysread in the new function, it worked then failed later when getblocks was called, so the open file handle works fine in the constructor, but dies somewhere before I call getblocks.

    I also tried standard open,read,write,seek and got the same problem.

    I need to access devices (whole point of the code) and I need to use sysread and syswrite because I want to bypass the buffered IO.