Beefy Boxes and Bandwidth Generously Provided by pair Networks
Perl: the Markov chain saw
 
PerlMonks  

could be directory "virtualized" from perl, like PerlIO but for directories?

by vkon (Curate)
on Feb 06, 2011 at 19:35 UTC ( #886541=perlquestion: print w/replies, xml ) Need Help??
vkon has asked for the wisdom of the Perl Monks concerning the following question:

Hi,

Everyone knows that perl IO could be "intercepted" using PerlIO layer, i.e. one could create file handle that is mapped into memory (or anywhere else)

Is it possible for directories?

Something like Tie::TextDir - but other way round - Tie::TextDir maps directory to tied perl hash, but I want the opposite - any read of said directory should consult my hash (or just call my callback).

To say, tcl/tk have this mechanics.
I wonder - does perl have this possibility?

TIA,
vkon

  • Comment on could be directory "virtualized" from perl, like PerlIO but for directories?

Replies are listed 'Best First'.
Re: could be directory "virtualized" from perl, like PerlIO but for directories?
by snoopy (Deacon) on Feb 07, 2011 at 05:00 UTC
    On the heavy side, Fuse::Simple lets you map a file system to Perl hashes.

    FUSE is implemented at the OS level rather than being Perl specific. it doesn't require root access, but does need a server process (or at least a thread).

    The files are really mounted and are visible to Perl and other processes. It's a deeper abstraction which may or may not be what you want.

    As a final catch, the underlaying Fuse module claims to only work well under Linux or BSD. FUSE however is widely available on other platforms, including Windows.

    I just thought it might be of interest. See also the wikipedia entry Filesystem_in_Userspace.

Re: could be directory "virtualized" from perl, like PerlIO but for directories?
by ikegami (Pope) on Feb 07, 2011 at 03:19 UTC
    Globally overriding opendir and readdir might do what you are trying to do. It won't affect XS modules, though.
Re: could be directory "virtualized" from perl, like PerlIO but for directories?
by Anonymous Monk on Feb 07, 2011 at 00:14 UTC

Log In?
Username:
Password:

What's my password?
Create A New User
Node Status?
node history
Node Type: perlquestion [id://886541]
Approved by planetscape
Front-paged by Corion
help
Chatterbox?
[Corion]: Is anybody aware of what makes Android Oreo better than Android Nougat? I'm not sure if the architectural changes (etc) are there already that make upgrading an Oreo-kernel phone to a newer Android userland (Lineage OS) version feasible
[Corion]: Yeah, CryTek got blindsided (or whatever) by Unity and Unreal Engine being zero cost, and the CryTek documentation being bad/nonexistent I think
[Corion]: "zero monetary cost", because of course, it's gratis only if your time has no value :)
[marto]: I used to keep up to date with my android ROMs, updating to the nightly every other day
[marto]: in my experience the jump in major releases has been painless, and performed better
[marto]: Corion if your device has an official Oreo ROM I'd do a nandroid backup and give it a shot

How do I use this? | Other CB clients
Other Users?
Others musing on the Monastery: (4)
As of 2017-12-14 10:41 GMT
Sections?
Information?
Find Nodes?
Leftovers?
    Voting Booth?
    What programming language do you hate the most?




















    Results (389 votes). Check out past polls.

    Notices?