in reply to Re: Re: Tie::File is sucking the life out of me
in thread Tie::File is sucking the life out of me

0) That makes a big difference, and is one possibility I suspected all along. Can you verify that the script you posted replicates the errant behavior? Because for me it doesn't. Since you're not showing us the actual code, it is encumbant on you to provide code that replicates the problem without introducing other bugs (ie, wild goose chases).

1) Fine, but again we didn't know that. The fact is that your double-use of the same file isn't causing a problem in this case, it's just asking for trouble if you use it in production though. And we had no way of knowing that your test code introduced elements not present in your production code.

2) Are both machines the same OS? If not, did you make sure to convert your line endings? I'm still keeping that one open as an option.

3) I ran your script using a text file instead of an empty file. I also ran it with an empty file as you're doing. It worked fine both ways. So again I have to ask if this snippet you've provided replicates the errant behavior.

As I said before, if you're dealing with different operating systems, ensure that you have converted your line endings.

And jeffa may also be right, with the suggestion to ensure that on both of your machines, your script has permission to work with the file in question.


Dave

  • Comment on Re: Re: Re: Tie::File is sucking the life out of me

Replies are listed 'Best First'.
Re: Re: Re: Re: Tie::File is sucking the life out of me
by GaijinPunch (Pilgrim) on Apr 27, 2004 at 08:20 UTC
    Okay, I figured it out. It was the permissions, even though anyone could read the file when I ran 'ls -ltr'.

    Is there something different about reading a file via file handle, as opposed to Tie::File? This is why I tried it the conventional way -- to see if I had permission to read the file.

    Anyways, thanks for the help.
      It seems unlikely that Tie::File is silently failing to open the file. Did your original code have the "or die..." part as part of the 'tie' statement?

      The permissions issue can crop up if your script has read-only permission. Tie::File by default tries to open for read/write. If you want it to open for read-only, you have to use the mode attribute when you initiate the tie.


      Dave

        If the original script had the same "tie" line as the example shown, it has "|| die" where it should have "or die", so errors returned by tie would have been ignored.