Piers Harding > VFS-Gnome-0.04 > VFS::Gnome

Download:
VFS-Gnome-0.04.tar.gz

Dependencies

Annotate this POD

View/Report Bugs
Module Version: 0.04   Source   Latest Release: VFS-Gnome-0.05

NAME ^

VFS::Gnome - Gnome Virtual Filesystem for Perl

SYNOPSIS ^

  use VFS::Gnome;

  vfsopen(*IN, "<http://www.piersharding.com") or die $!;
  # dont forget the * when using strict
  print while (<IN>);
  close IN;

DESCRIPTION ^

VFS::Gnome is a TIEHANDLE module that uses the gnome-vfs library from the Gnome project (http://www.gnome.org). The gnome-vfs library (Virtual File System) allows uniform access to various uri types such as http://, https://, file://, ftp:// etc.

METHODS ^

vfsopen()

vfsopen is pushed into the users calling namespace via the import statement, so there is no need to fully qualify it.

vfsopen(*FH, ">file:///tmp/some.file") or die $!;

Because use strict forbids the use of barewords, then you must remember to use the * (typeglob notation) on your filehandle - but only for the vfsopen there after it is not required.

VFS::Gnome supports:

other functions

once opened - a file handle behaves much like an ordinary one, in that you can "print" to it, and read from it with the "<>" (diamond) operator.

vfsstat()

vfsstat takes a single argument of a uri and returns a 13 element array of information as the core perl stat() function does.

0 dev device number of filesystem (currently undef)
1 inode inode number (currently undef)
2 mode file mode (type and permissions in character form)
3 nlink number of (hard) links to the file
4 uid numeric user ID of file's owner
5 gid numeric group ID of file's owner
6 rdev the device identifier (special files only)
7 size total size of file, in bytes
8 atime last access time in seconds since the epoch
9 mtime last modify time in seconds since the epoch
10 ctime inode change time (NOT creation time!) in seconds since the epoch
11 blksize preferred block size for file system I/O
12 blocks actual number of blocks allocated
13 type a new entry specifying the type This can be f - file, d - directory, p - pipe, s - socket, c - character device, b - block device, l - link
14 name a new entry specifying the file name ( minus the path )

vfsexists()

vfsexists takes a single argument of a uri and returns true if it exists.

vfsmove()

vfsmove takes two arguments - the from and to uri's, and returns true if the file was successfully transported.

vfsunlink()

vfsunlink takes a single argument of a uri and returns true if the file is successfully unlinked/deleted.

vfsopendir()

vfsopendir opens a handle on a directory in the same style as a TIED files handle. This is used in preference to trying to imitate the opendir, readdir, closedir syntax of Perl, that can not be imitated thru the tie() operation.

vfsopendir(*DIR, "file:///tmp") or die $!;

Because use strict forbids the use of barewords, then you must remember to use the * (typeglob notation) on your filehandle - but only for the vfsopendir there after it is not required.

subsequently the handle can be addressed in two ways:

VERSION ^

very new

AUTHOR ^

Piers Harding - piers@cpan.org

SEE ALSO ^

  http://developer.gnome.org/doc/API/gnome-vfs/ and perldoc Tie::Handle

COPYRIGHT ^

Copyright (c) 2002, Piers Harding. All Rights Reserved. This module is free software. It may be used, redistributed and/or modified under the same terms as Perl itself.

syntax highlighting: