Slash Boxes
NOTE: use Perl; is on undef hiatus. You can read content, but you can't post it. More info will be forthcoming forthcomingly.

All the Perl that's Practical to Extract and Report

use Perl Log In

Log In

[ Create a new account ]

ChrisDolan (2855)

  (email not shown publicly)

Journal of ChrisDolan (2855)

Wednesday November 14, 2007
10:46 PM


[ #34900 ]

I have a lot of programming niche interests -- video, VNC, static analysis, PDF, filesystems, Flash, SOAP, etc. Most of all, I love it when these interests intersect. For example, I wrote still-closed-source (sigh) library that converts a VNC stream to QuickTime. A prototype of that software was the basis for the YAPC::NA 2006 videos I produced.

Another convergence happened last week. Google released MacFUSE 1.x, a Mac port of the Linux user-mode filesystem code. I had tried an earlier version, but I never got the Perl bindings ( to work right. What can this do? It lets you write your own mountable virtual filesystem in a couple hundred lines of code.

Back in 2002-2005, I did a ton of PDF work. A result of that was a base library, CAM::PDF. I got authority to release it to CPAN about the same time the business motivation for the library dried up. But in the process, I learned the PDF specification inside and out. PDF is basically a serialization of an arbitrary tree structure: strings, numbers, hashes, arrays, references and blobs, all in an almost-human-readable syntax.

You can store anything in PDF. Most of that tree is focused on storing pages, text and graphics, but the fascinating part is that's just convention. The underlying data structure is generic.

So why not put filesystem data and metadata inside a PDF? I mentioned the idea at the last Madison Perl Mongers meeting and they laughed at me! (LAUGHED! at ME!) Well, that was enough motivation! A weekend later, I released Fuse:PDF v0.01 to CPAN. It's still very worthy of the v0.01 label (no symlinks, no hardlinks, no large files) but it's usable.

What do you think? Inspired or daft? Should I have put it in the Acme:: namespace? :-)

[Along the way, I'm also writing Test::Virtual::Filesystem which is a collection of typical file I/O actions that should work on any mounted filesystem.]

The Fine Print: The following comments are owned by whoever posted them. We are not responsible for them in any way.
More | Login | Reply
Loading... please wait.
  • I saw in your CPAN review that it was difficult to figure out the minimum number of functions required to be implemented by a perl FUSE filesystem - did you find this documented anywhere (or document it yourself)?
    • No, I just kept implementing methods until I was satisfied with the behavior. :-)

      Seriously, though, statfs and getattr are probably the bare minimum, followed by mknod getdir open and read.

      Take a peek at Test::Virtual::Filesystem which can help to validate your FUSE implementation.
      • Oh, fantastic, I didn't even see the test suite when I was looking last night. Your methodology is admirable.

        I'm going to take a stab at an 'md5uniqfs', which stores one copy of a given file per filesytem, hardlinking duplicates. Should be useful for backups.

        Having a good test should really help. Thanks!