Beefy Boxes and Bandwidth Generously Provided by pair Networks
Welcome to the Monastery
 
PerlMonks  

Re: Should I be using tie for this?

by Anonymous Monk
on Jun 16, 2004 at 20:44 UTC ( [id://367421]=note: print w/replies, xml ) Need Help??


in reply to Should I be using tie for this?

perldoc Tie::File
# This file documents Tie::File version 0.97 use Tie::File; tie @array, 'Tie::File', filename or die ...; $array[13] = 'blah'; # line 13 of the file is now 'blah' print $array[42]; # display line 42 of the file
ARRAY ARRAY ARRAY ARRAY

Replies are listed 'Best First'.
Re^2:Should I be using tie for this?
by Plankton (Vicar) on Jun 16, 2004 at 20:53 UTC
    Thanks. I saw that. I guess I should restate my question. Can I use Tie::File with a object instead of an array. And assuming that ...

    ARRAY ARRAY ARRAY ARRAY

    ... is not Anony Monks's sig. I guess you are saying I cannot use Tie::File with anything but an array. Right?

    Plankton: 1% Evil, 99% Hot Gas.

      Let's back up to this: "store my data to disk rather than memory". OK, so let's say that you do successfully store your data to disk. Now what? I mean, how do you use it in your program? You have to read it back into memory. Now you have a new problem -- which parts to pull from the file into memory and which parts to move from memory into the file. Tie::Cache::LRU might make this task easier, however.

      Sounds to me like you are trying to do too much. Try filtering the results down, or use some sort of pagination scheme to only deal with a small window of the entire set, instead of the entire set. As far as storing "objects" ... look into Serialization: Freeze::Thaw and YAML come to mind.

      jeffa

      L-LL-L--L-LL-L--L-LL-L--
      -R--R-RR-R--R-RR-R--R-RR
      B--B--B--B--B--B--B--B--
      H---H---H---H---H---H---
      (the triplet paradiddle with high-hat)
      

Log In?
Username:
Password:

What's my password?
Create A New User
Domain Nodelet?
Node Status?
node history
Node Type: note [id://367421]
help
Chatterbox?
and the web crawler heard nothing...

How do I use this?Last hourOther CB clients
Other Users?
Others chilling in the Monastery: (2)
As of 2024-04-20 03:04 GMT
Sections?
Information?
Find Nodes?
Leftovers?
    Voting Booth?

    No recent polls found