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

Re^4: Tie::Filesystem - request for review

by erikharrison (Deacon)
on Jun 23, 2004 at 07:06 UTC ( [id://368958]=note: print w/replies, xml ) Need Help??


in reply to Re^3: Tie::Filesystem - request for review
in thread Tie::Filesystem - request for review

Actually, building a simple perl VFS on top of this was a plan from the begining

The reason that, say, $fs{etc}->{passwd} == '/etc/passwd' currently is because the downside of this interfece is that it is difficult to get the full pathname without walking back up the tree. Having the full path name gives the programmer flexibilty and keeps the thing light.

What about this: an optional argument to the tie is a closure. This closure takes the full path to a file, and returns some arbitrary scalar - a filehandle ref, the leafname, a Tie::File array ref, whatever. How's that sound?

Cheers,
Erik

Light a man a fire, he's warm for a day. Catch a man on fire, and he's warm for the rest of his life. - Terry Pratchet

Replies are listed 'Best First'.
Re^5: Tie::Filesystem - request for review
by jepri (Parson) on Jun 24, 2004 at 00:56 UTC
    I'm not quite sure of the what you are suggesting there, but it does sound good. Having a unique key for each file is nice, but I'm tempted to suggest that I can build that very easily as I do my hash traversal. In use, I'm likely to get the hashref for the directory, and then iterate over the files or something like that.

    The obvious solution would be an object, but I'm not found of objects in this sort of work. They aren't particularily perlish. I'm not exactly sure what would be though.

    I look forwards to your publishing your code - I have a use for it so I can guarantee you a user right away.

    ___________________
    Jeremy
    I didn't believe in evil until I dated it.

Log In?
Username:
Password:

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

How do I use this?Last hourOther CB clients
Other Users?
Others exploiting the Monastery: (3)
As of 2024-03-19 07:32 GMT
Sections?
Information?
Find Nodes?
Leftovers?
    Voting Booth?

    No recent polls found