Beefy Boxes and Bandwidth Generously Provided by pair Networks
Come for the quick hacks, stay for the epiphanies.
 
PerlMonks  

Re: Proof of concept: File::Index

by spiritway (Vicar)
on May 12, 2006 at 18:00 UTC ( [id://549077]=note: print w/replies, xml ) Need Help??


in reply to Proof of concept: File::Index

This looks like a great solution to a fairly common and annoying problem. I do have a question, though. If the user thinks the file and index are out of sync, (s)he can recreate the index. No problem there. But what happens if some other process diddles with the file? Or rather, what would protect the file, once it's created?

I could see some other program writing to the file, unaware of its special status, and trashing the relationship with the index. If then a user relies on the index, bad things could happen. Perhaps a sort of sanity check (modification times match)?

Replies are listed 'Best First'.
Re^2: Proof of concept: File::Index
by davido (Cardinal) on May 13, 2006 at 15:48 UTC

    Yes, future enhancements will perform basic sanity checks. It's a slipery slope though; I could perform a checksum check, but then that defeats the efficiency purpose of storing the index in the first place. The best suggestions have been to keep track of modification times and file sizes. While not idiot-proof, such enhancements will catch a lot of out of sync problems.

    Ultimately it will be up to the module's users to decide if the file being indexed is reliable enough to be worth indexing, and how often it will need to be re-indexed. There are some situations where it just won't be practical; such as in environments where many sources are contributing to the data file at unknown intervals.


    Dave

      I feel your pain - when is it ever enough, vs. when does it cost too much to check these things?

      Even so this looks to be a great solution to a whole lot of semi-minor major problems, where you don't want to just slurp the file, but don't much care to walk through it ever time, either. I think it's great;-).

      Update: Corrected "minor" mistake.

Log In?
Username:
Password:

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

How do I use this?Last hourOther CB clients
Other Users?
Others imbibing at the Monastery: (4)
As of 2024-04-19 17:33 GMT
Sections?
Information?
Find Nodes?
Leftovers?
    Voting Booth?

    No recent polls found