in reply to Problem with Tie::File

Show some code. The minimal complete program necessary to reproduce the problem. Thanks.

Replies are listed 'Best First'.
Re^2: Problem with Tie::File
by psandie (Initiate) on Feb 09, 2009 at 13:44 UTC
    Unfortunately that's not so easy. The processing of the arrays is fairly extensive (runs to hundreds of lines). I had hoped what I'd put might just ring a bell with somone who'd seen similar problems. The fact that it works with small files but not large ones perplexes me. It may be that I'm running into memory problems I guess. I don't know the inner workings of the Tie code but I suppose if I tie large files I'm ultimately using a lot of memory.

      I'm not asking you to post your production code, unaltered. You can replace your "processing" (whatever that is; you don't say) with some kind of no-op. That's why I said "minimal complete". Strip it down. Please. I'd like to try to help.

      Also, please make sure you have read and understand the Tie::File Caveats.

      Between the mind which plans and the hands which build, there must be a mediator... and this mediator must be the heart.
        Ok, here is the cut down version of what's being done:
        my @actualData; my @expectedData; # $actualFile and $expectedFile are the names of the files # that will be diff'ed. # At this point they are unmodified copies of the files I # want to manipulate and then compare tie (@actualData, tie::File, $actualFile, mode => O_RDWR, autodefer => + 0); tie (@expectedData, tie::File, $expectedFile, mode => O_RDWR, autodefe +r => 0); # Here would do lots of stuff with @actualData # and @expectedData untie @actualData; untie @expectedData; # ...and here would do the file comparison of $actualFile and $expecte +dFile
        I had a look at the caveats but couldn't see anything there that worried me (I'm not bothered about performance issues).

      Maybe if the files are larger there are "conditions" that apply which are not foreseen and the code "breakes (the programs dies e.g.)" at these larger files, but i am not experienced enough to give you detailed hints what to search for, as already mentioned maybe memory. Perl is only limited by your (computing) ressources there is no "hard" limit which is set by Perl ... Perhaps printing debugging lines could help to see where it is broken or printing the contents of variables/arrays into a log-file but i really dont know the best practices on this ...


      hth
      MH