Krang::FTP::FileHandle - Virtual FTP Server FileHandle
None.
This module provides a file handle object for use by Krang::FTP::Server.
This module inherits from Net::FTPServer::FileHandle and overrides the required methods. This class is used internally by Krang::FTP::Server.
Creates a new Krang::FTP::FileHandle object. Requires 4 arguments: the Krang::FTP::Server object, the Krang::Media or Krang::Template object, the $type (media or template) of the represented object, and the and the category_id which this file is in.
open($mode)
This method opens this template/media 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/media text. For read-only access a plain IO::Scalar object is returned. For write-methods an internal tied class - Krang::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 ``ci'' 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.
delete()
Deletes the current media/template. This has the same effect as deleting the object thru the UI.
Returns permissions information for various activites. can_read()
always returns 1 since media/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
media/template - if it's checked in and the user has permission.
Net:FTPServer::FileHandle