| Net-FTPServer documentation | Contained in the Net-FTPServer distribution. |
Net::FTPServer::DirHandle - A Net::FTPServer directory handle.
use Net::FTPServer::DirHandle;
Create a new directory handle. The directory handle corresponds to "/".
Return the parent directory of the directory $dirh. If
the directory is already "/", this returns the same directory handle.
Return true if the current directory is the root directory.
Return the file or directory $handle corresponding to
the file $filename in directory $dirh. If there is
no file or subdirectory of that name, then this returns
undef.
Return a list of the contents of directory $dirh. The list
returned is a reference to an array of pairs:
[ $filename, $handle ]
The list returned does not include "." or "..".
The list is sorted into alphabetical order automatically.
Just a dumb wrapper function. Returns the same thing as list_status(), but also includes the special directories "." and ".." if no wildcard is specified.
Return a list of the contents of directory $dirh and
status information. The list returned is a reference to
an array of triplets:
[ $filename, $handle, $statusref ]
where $statusref is the tuple returned from the status
method (see Net::FTPServer::Handle).
The list returned does not include "." or "..".
The list is sorted into alphabetical order automatically.
Delete the current directory. If the delete command was successful, then return 0, else if there was an error return -1.
It is normally only possible to delete a directory if it is empty.
Create a subdirectory called $name within the current directory
$dirh.
Open or create a file called $filename in the current directory,
opening it for either read, write or append. This function
returns a IO::File handle object.
Richard Jones (rich@annexia.org).
Copyright (C) 2000 Biblio@Tech Ltd., Unit 2-3, 50 Carnwath Road, London, SW6 3EG, UK
Net::FTPServer(3), perl(1)
| Net-FTPServer documentation | Contained in the Net-FTPServer distribution. |
# -*- perl -*- # Net::FTPServer A Perl FTP Server # Copyright (C) 2000 Bibliotech Ltd., Unit 2-3, 50 Carnwath Road, # London, SW6 3EG, United Kingdom. # # This program is free software; you can redistribute it and/or modify # it under the terms of the GNU General Public License as published by # the Free Software Foundation; either version 2 of the License, or # (at your option) any later version. # # This program is distributed in the hope that it will be useful, # but WITHOUT ANY WARRANTY; without even the implied warranty of # MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the # GNU General Public License for more details. # # You should have received a copy of the GNU General Public License # along with this program; if not, write to the Free Software # Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA # $Id: DirHandle.pm,v 1.1 2003/09/28 11:50:45 rwmj Exp $
package Net::FTPServer::DirHandle; use strict; use vars qw($VERSION); ( $VERSION ) = '$Revision: 1.1 $ ' =~ /\$Revision:\s+([^\s]+)/; use Carp qw(confess); use Net::FTPServer::Handle; use vars qw(@ISA); @ISA = qw(Net::FTPServer::Handle);
sub new { my $class = shift; my $ftps = shift; # Only internal calls will supply the $path argument. It must end # with a "/". my $path = shift || "/"; my $self = Net::FTPServer::Handle->new ($ftps); $self->{_pathname} = $path; return bless $self, $class; }
sub parent { my $self = shift; # Already in "/" ? return $self if $self->is_root; my $new_pathname = $self->{_pathname}; $new_pathname =~ s,[^/]*/$,,; return Net::FTPServer::DirHandle->new ($self->{ftps}, $new_pathname); }
sub is_root { my $self = shift; return $self->{_pathname} eq "/"; }
sub get { confess "virtual function"; }
sub list { confess "virtual function"; }
sub _list_status { my $self = shift; my $wildcard = shift; my @array = (); unless ($wildcard) { # I suppose that there will be some FTP clients out there which # will get confused if they don't see . and .. entries. push (@array, [ ".", $self ]); push (@array, [ "..", $self->parent ]); } push (@array, @{ $self->list_status ($wildcard) }); return \@array; }
sub list_status { confess "virtual function"; }
sub delete { confess "virtual function"; }
sub mkdir { confess "virtual function"; }
sub open { confess "virtual function"; } 1 # So that the require or use succeeds. __END__