Olivier Thauvin > VFSsimple-0.03 > VFSsimple::Base

Download:
VFSsimple/VFSsimple-0.03.tar.gz

Dependencies

Annotate this POD

View/Report Bugs
Source  

NAME ^

VFSsimple::Base

DESCRIPTION ^

A based module for any VFSimple driver.

SYNOPSIS ^

    package VFSsimple::Drv::Any;

    use base qw(VFSsimple::Base);
    use File::Copy;

    our $VERSION = '0.01';

    sub drv_new {
        my ($self) = @_;
        ...
        return $self;
    }

    sub drv_get {
        my ($self, $src) = @_;
        return $self->{realroot} . '/' . $src;
    }

    sub drv_copy {
        my ($self, $src, $dest) = @_;
        return File::Copy::copy($self->{realroot} . '/' . $src, $dest) ? $dest : ();
    }

    1;

PROVIDED FUNCTIONS ^

set_error($fmt, ...)

Store last error message

root

Return the root url of the VFS

archive_path

If VFS handle a tree inside an archive, return the path of this archive.

archive_path

If VFS handle a tree inside an archive, return the virtual root path inside the archive.

FUNCTIONS PROVIDED BY DRIVER ^

drv_new

This function is called during object creation (new). It receive as arguments the fresh blessed object and allow the driver to load data it will need to work.

Should return the object in case of success, nothing on error.

drv_copy($source, $dest)

This function should copy $source relative path from vfs to $dest local path.

Should return True on success.

drv_get($src)

Should return any file path where the file can be locally found, nothing on error.

If this function is not provided, a default from VFSimple::Base is provided generating a temporary file and using drv_copy() to fetch it.

drv_open($src)

Should return a read only file handle for relative path $src.

If the function is not provide, default return an open file handle over a deleted temp file using drv_copy to fetch the file.

drv_exists($file)

Should true if $file exists

SEE ALSO ^

VFSimple

LICENSE AND COPYRIGHT ^

(c) 2006, 2007 Olivier Thauvin <nanardon@nanardon.zarb.org>

/* This program is free software. It comes without any warranty, to * the extent permitted by applicable law. You can redistribute it * and/or modify it under the terms of the Do What The Fuck You Want * To Public License, Version 2, as published by Sam Hocevar. See * http://sam.zoy.org/wtfpl/COPYING for more details. */

    DO WHAT THE FUCK YOU WANT TO PUBLIC LICENSE
    Version 2, December 2004

    Copyright (C) 2004 Sam Hocevar
    14 rue de Plaisance, 75014 Paris, France
    Everyone is permitted to copy and distribute verbatim or modified
    copies of this license document, and changing it is allowed as long
    as the name is changed.

    DO WHAT THE FUCK YOU WANT TO PUBLIC LICENSE
    TERMS AND CONDITIONS FOR COPYING, DISTRIBUTION AND MODIFICATION

    0. You just DO WHAT THE FUCK YOU WANT TO.
syntax highlighting: