Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Virtual filesystem in Perl

Tags:

perl

I'm looking for a virtual filesystem layer in Perl. Something that would provide a general abstraction for basic filesystem routines like ls, mkdir and so on, regardless how the actual filesystem is implemented.

I'd like an interface like this:

# create a directory "/some/path/tmp" in my current filesystem
my $plainfs = Module::new->(type => 'local', root=>'/some/path);
$plainfs->mdkir("/tmp"); 

# create "tmp" dir on a remote filesystem
my $sshfs = Module::new->(type=>'ssh', root=>'user:[email protected]:~/pub')
$sshfs->mdkir("/tmp"); 

I found the VFS package on MetaCPAN, unfortunately there are only empty, unimplemented modules.

Is something already implemented? Right now, I'm looking for only “local” filesystems and ftp or ssh—I don't need a database “filesystem” or any other exotic “filesystem” like CVS or so. Searching 20k MetaCPAN modules is painful without any tagging system or alike…

like image 724
kobame Avatar asked Jul 14 '13 07:07

kobame


2 Answers

Perhaps File::System is what you're looking for. It provides basic functionalities found in common operating systems for managing a virtual file system (not necessarily comprised only of files and directories).

Most of the functionalities are presented as method of the File::System::Object package.

like image 140
Jose Faeti Avatar answered Nov 01 '22 05:11

Jose Faeti


what about some FUSE implementation? ( file system in userspace ) ? I would guess there is at least one pseudo-filesystem implemented in perl based on that. After all, it should be quite easy to implement, basically it's no more than some set of operations like mount, ls, df, stat and so on. I was once through autofs sources in C, looked pretty straightforward. You might want to see http://code.google.com/p/mogilefs/ as well.

like image 44
Piotr Wadas Avatar answered Nov 01 '22 06:11

Piotr Wadas