Bric::Util::FTP::FileHandle(3)

NAME
Bric::Util::FTP::FileHandle - Virtual FTP Server FileHandle

VERSION
$LastChangedRevision$

DATE
$LastChangedDate: 2004-07-06 22:55:36 -0700 (Tue, 06 Jul 2004) $

DESCRIPTION
This module provides a file handle object for use by Bric::Util::FTP::Server.

INTERFACE
This module inherits from Net::FTPServer::FileHandle and overrides the required methods. This class is used internally by Bric::Util::FTP::Server.

  Constructors

new($ftps, $template, $site_id, $oc_id, $category_id)
    Creates a new Bric::Util::FTP::FileHandle object. Requires three arguments: the Bric::Util::FTP::Server object, the Bric::Biz::Asset::Formatting object that this filehandle represents (aka the template object), and the category_id for the category that thetemplate is in.

  Public Instance Methods

open($mode)
    This method opens this template object for access using the provided mode ('r', 'w' or 'a'). The method returns an IO::Scalar object that will be used by Net::FTPServer to access the template text. For read-only access a plain IO::Scalar object is returned. For write-methods an internal tied class - Bric::Util::FTP::FileHandle::SCALAR - is used with IO::Scalar to provide write-access to the data in the database. Returns undef on failure.

dir()
    Returns the directory handle for the category that this template is in. Calls Bric::Util::FTP::DirHandle->new().

status()
    This method returns information about the object. The return value is a list with seven elements - ($mode, $perms, $nlink, $user, $group, $size, $time). To quote the good book (Net::FTPServer::Handle):

              $mode     Mode        'd' = directory,
                                    'f' = file,
                                    and others as with
                                    the find(1) -type option.
              $perms    Permissions Permissions in normal octal numeric format.
              $nlink    Link count
              $user     Username    In printable format.
              $group    Group name  In printable format.
              $size     Size        File size in bytes.
              $time     Time        Time (usually mtime) in Unix time_t format.

    $mode is always 'f'. $perms is set depending on wether the template is checked out and whether the user has access to edit the template. $nlink is always 1. $user is set to the user that has the template checked out or "nobody" for checked in templates. $group is "co" if the template is checked out, "ci" if it's checked in. $size is the size of the template text in bytes. $time is set to the deploy_time() of the template.

move()
    Deploys the template if the new name is the same as the template name followed by '.deploy'. Otherwise it's a no-op.

delete()
    Deletes the current template. This has the same effect as deleting the template through the UI - it undeploys the template if it's deployed and marks it inactive.

can_*()
    Returns permissions information for various activites. can_read() always returns 1 since templates can always be read. can_rename() and can_delete() return 0 since these operations are not yet supported. can_write() and can_append() return 1 if the user can write to the template - if it's checked in and the user has permission.

PRIVATE

  Private Classes

Bric::Util::FTP::FileHandle::SCALAR
    This class provides a tied scalar interface to a template object's data. The TIESCALAR constructor takes a template object as a single argument. Writes to the tied scalar result in the template object being altered, saved, checked-in and deployed.

AUTHOR
Sam Tregar <stregar@about-inc.com>

SEE ALSO
<Net:FTPServer::FileHandle|Net:FTPServer::FileHandle>

Bric::Util::FTP::Server

Bric::Util::FTP::DirHandle