Bric::Util::FTP::FileHandle - Virtual FTP Server FileHandle $LastChangedRevision$ $LastChangedDate: 2005-10-10 00:15:55 -0700 (Mon, 10 Oct 2005) $ This module provides a file handle object for use by Bric::Util::FTP::Server. This module inherits from Net::FTPServer::FileHandle and overrides the required methods. This class is used internally by Bric::Util::FTP::Server.

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

Public Instance Methods
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 instance of an internal subclass of IO::Scalar--Bric::Util::FTP::FileHandle::IO--is used to provide write access to the data in the database. Returns "undef" on failure. Returns the directory handle for the category that this template is in. Calls Bric::Util::FTP::DirHandle->new(). 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. Deploys the template if the new name is the same as the template name followed by '.deploy'. Otherwise it's a no-op. 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. 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 Classes
This class subclasses IO::Scalar to encapsulate the interface to a template object's data. The "new()" constructor takes a scalar variable as a first argument, followed by a parameter list. The supported parameters are: An instance of the Bric::Util::FTP::Server class. An instance of the Bric::Util::FTP::FileHandle class. Bric::Util::FTP::FileHandle::IO objects track when data has been written to the underlying scalar, and, if so, write the data to the underlying template object when the file handle is closed. It also properly handles deploying the template to the user's sandbox, and deploying the template to production if the name of the file ends in ".deploy". Sam Tregar <stregar@about-inc.com> David Wheeler <david@kineticode.com> <Net:FTPServer::FileHandle|Net:FTPServer::FileHandle> Bric::Util::FTP::Server Bric::Util::FTP::DirHandle