Fuse-PDF

 view release on metacpan or  search on metacpan

README  view on Meta::CPAN

    than many other PDF implementations and may fail to open PDFs that, say,
    Acrobat or Preview.app can open. In particular, "Print to PDF" on Mac OS
    X 10.4 often generates bad PDFs.

    Threading: I've explicitly set the FUSE default to single-threaded mode,
    so performance may be terrible in some scenarios. I hope to add support
    for threaded Perl in a future release. Patches welcome (remove the
    `threaded => 0' line from this file and add locking to Fuse::PDF::FS).

    Unsupported: special files (named pipes, etc.), following symlinks out
    of the filesystem, permission enforcement, `chown', `flush', reading
    from unlinked filehandles.

    Hard links: I have not yet implemented hard links. I'll implement
    compressed streams at the same time.

METHODS
    $pkg->new($pdf_filename)
    $pkg->new($pdf_filename, $hash_of_options)
        Create a new filesystem instance. This method opens and parses the
        PDF document. If there is an error opening or parsing the PDF

lib/Fuse/PDF.pm  view on Meta::CPAN

            my ($srcfile, $file) = @_;
            return $fs->fs_link($srcfile, $file);
         }
      ) : (),
      $fs->can('fs_chmod') ? (
         chmod => sub {
            my ($file, $perms) = @_;
            return $fs->fs_chmod($file, $perms);
         }
      ) : (),
      $fs->can('fs_chown') ? (
         chown => sub {
            my ($file, $uid, $gid) = @_;
            return $fs->fs_chown($file, $uid, $gid);
         }
      ) : (),
      $fs->can('fs_truncate') ? (
         truncate => sub {
            my ($file, $length) = @_;
            return $fs->fs_truncate($file, $length);
         }
      ) : (),
      $fs->can('fs_utime') ? (
         utime => sub {

lib/Fuse/PDF.pm  view on Meta::CPAN

Preview.app can open.  In particular, "Print to PDF" on Mac OS X 10.4
often generates bad PDFs.

B<Threading:> I've explicitly set the FUSE default to single-threaded
mode, so performance may be terrible in some scenarios.  I hope to add
support for threaded Perl in a future release.  Patches welcome
(remove the C<threaded =E<gt> 0> line from this file and add locking
to L<Fuse::PDF::FS>).

B<Unsupported:> special files (named pipes, etc.), following symlinks
out of the filesystem, permission enforcement, C<chown>, C<flush>,
reading from unlinked filehandles.

B<Hard links:> I have not yet implemented hard links.  I'll implement
compressed streams at the same time.

=head1 METHODS

=over

=item $pkg->new($pdf_filename)

lib/Fuse/PDF/ContentFS.pm  view on Meta::CPAN

sub fs_chmod {
   my ($self, $abspath, $perms) = @_;
   my ($f, $path) = $self->_file($abspath);
   if (defined $path) {
      return -EIO() if !$f->can('fs_chmod');
      return $f->fs_chmod($path, $perms);
   }
   return -EIO();
}

sub fs_chown {
   my ($self, $abspath, $uid, $gid) = @_;
   my ($f, $path) = $self->_file($abspath);
   if (defined $path) {
      return -EIO() if !$f->can('fs_chown');
      return $f->fs_chown($path, $uid, $gid);
   }
   return -EIO();
}

sub fs_truncate {
   my ($self, $abspath, $length) = @_;
   my ($f, $path) = $self->_file($abspath);
   if (defined $path) {
      return -EIO() if !$f->can('fs_truncate');
      return $f->fs_truncate($path, $length);

lib/Fuse/PDF/ContentFS.pm  view on Meta::CPAN

=item $self->fs_rmdir($file)

=item $self->fs_symlink($link, $file)

=item $self->fs_rename($oldfile, $file)

=item $self->fs_link($srcfile, $file)

=item $self->fs_chmod($file, $perms)

=item $self->fs_chown($file, $uid, $gid)

=item $self->fs_truncate($file, $length)

=item $self->fs_utime($file, $atime, $utime)

=item $self->fs_open($file, $mode)

=item $self->fs_read($file, $size, $offset)

=item $self->fs_write($file, $str, $offset)

lib/Fuse/PDF/FS.pm  view on Meta::CPAN

sub fs_chmod {
   my ($self, $abspath, $perms) = @_;
   my $f = $self->_file($abspath);
   return -$f if !ref $f;
   $f->{mode}->{value} = S_IFMT($f->{mode}->{value}) | S_IMODE($perms);
   $self->{fs}->{mtime}->{value} = time;
   $self->{dirty} = 1;
   return 0;
}

sub fs_chown {
   my ($self, $abspath, $uid, $gid) = @_;
   my $f = $self->_file($abspath);
   return -$f if !ref $f;
   #$f->{uid}->{value} = $uid;
   #$f->{gid}->{value} = $gid;
   #$self->{dirty} = 1;
   return 0;
}

sub fs_truncate {

lib/Fuse/PDF/FS.pm  view on Meta::CPAN

=item $self->fs_rmdir($file)

=item $self->fs_symlink($link, $file)

=item $self->fs_rename($oldfile, $file)

=item $self->fs_link($srcfile, $file)

=item $self->fs_chmod($file, $perms)

=item $self->fs_chown($file, $uid, $gid)

=item $self->fs_truncate($file, $length)

=item $self->fs_utime($file, $atime, $mtime)

=item $self->fs_open($file, $mode)

=item $self->fs_read($file, $size, $offset)

=item $self->fs_write($file, $str, $offset)

t/fusepdf.t  view on Meta::CPAN

   if (is_mounted()) {
      $success = 1;
      last;
   }
}
die 'Failed to mount the filesystem' if !$success;

my $test = Test::Virtual::Filesystem->new({mountdir => $mntdir, compatible => '0.08'});
# Leave symlink default alone.  Test::Virtual::Filesystem knows best.
$test->enable_test_xattr(1);
$test->enable_test_chown(0);
$test->enable_test_permissions(0);
$test->enable_test_special(0);
$test->enable_test_nlink(0);
$test->enable_test_hardlink(0);
$test->runtests;

eval {
   require Test::Memory::Cycle;
};
SKIP: {



( run in 0.914 second using v1.01-cache-2.11-cpan-71847e10f99 )