Gnome2::VFS(3pm)

Gnome2::VFS3pm

Perl interface to the 2.x series of the gnome vfs library

Usage

  use Gnome2::VFS;
  sub die_already {
    my ($action) = @_;
    die("An error occured while $action.\n");
  }
  die_already("initializing GNOME VFS") unless (Gnome2::VFS -> init());
  my $source = "http://www.perldoc.com/about.html";
  my ($result, $handle, $info);
  # Open a connection to Perldoc.
  ($result, $handle) = Gnome2::VFS -> open($source, "read");
  die_already("opening connection to '$source'")
    unless ($result eq "ok");
  # Get the file information.
  ($result, $info) = $handle -> get_file_info("default");
  die_already("retrieving information about '$source'")
    unless ($result eq "ok");
  # Read the content.
  my $bytes = $info -> { size };
  my $bytes_read = 0;
  my $buffer = "";
  do {
    my ($tmp_buffer, $tmp_bytes_read);
    ($result, $tmp_bytes_read, $tmp_buffer) =
      $handle -> read($bytes - $bytes_read);
    $buffer .= $tmp_buffer;
    $bytes_read += $tmp_bytes_read;
  } while ($result eq "ok" and $bytes_read < $bytes);
  die_already("reading $bytes bytes from '$source'")
    unless ($result eq "ok" && $bytes_read == $bytes);
  # Close the connection.
  $result = $handle -> close();
  die_already("closing connection to '$source'")
    unless ($result eq "ok");
  # Create and open the target.
  my $target = "/tmp/" . $info -> { name };
  my $uri = Gnome2::VFS::URI -> new($target);
  ($result, $handle) = $uri -> create("write", 1, 0644);
  die_already("creating '$target'") unless ($result eq "ok");
  # Write to it.
  my $bytes_written;
  ($result, $bytes_written) = $handle -> write($buffer, $bytes);
  die_already("writing $bytes bytes to '$target'")
    unless ($result eq "ok" && $bytes_written == $bytes);
  # Close the target.
  $result = $handle -> close();
  die_already("closing '$target'") unless ($result eq "ok");
  Gnome2::VFS -> shutdown();

Abstract

This module allows you to interface with the GNOME Virtual File System library. It provides the means to transparently access files on all kinds of filesystems.

Overview

Since this module tries to stick very closely to the C API, the documentation found at

  L<http://developer.gnome.org/doc/API/2.0/gnome-vfs-2.0/>

is the canonical reference.

In addition to that, there's also the automatically generated API documentation: Gnome2::VFS::index.

The mapping described in Gtk2::api also applies to this module.

To discuss this module, ask questions and flame/praise the authors, join [email protected] at lists.gnome.org.

Known bugs

There are some memory leaks especially with respect to callbacks. This mainly affects GnomeVFSAsync as well as some parts of GnomeVFSXfer and GnomeVFSOps. GnomeVFSMime leaks some list data.

GnomeVFSAsync is also known to crash under certain conditions when there are many concurrent transfers.

Releases

7 releases since Debian 3.1 (Sarge); the text changed 6 times.

  1. 3.1
  2. 4.0
  3. 5.0
  4. 6.0
  5. 7
  6. 8
  7. 9

Author

Torsten Schoenfeld <[email protected]>.

From libgnome2-vfs-perl 1.082-1+b3 in Debian 9 (Stretch). Parsed by carta from the page's man source.