🌻 📖 AnyEvent::FTP::Server::Role::Help

NAME

AnyEvent::FTP::Server::Role::Help - Help role for FTP server

VERSION

version 0.19

SYNOPSIS

Create a context:

 package AnyEvent::FTP::Server::Context::EchoContext;
 
 use Moo;
 
 extends 'AnyEvent::FTP::Server::Context';
 with 'AnyEvent::FTP::Server::Role::Help';
 
 # implement the non-existent echo command
 sub help_echo { 'ECHO <SP> text' }
 
 sub cmd_echo
 {
   my($self, $con, $req) = @_;
   $con->send_response(211 => $req->args);
   $self->done;
 }
 
 1;

Start a server with that context:

 % aeftpd --context EchoContext
 ftp://dfzcgohteq:igdcphxled@localhost:59402

Then connect to that server and test the HELP command:

 % telnet localhost 59402
 Trying 127.0.0.1...
 Connected to localhost.
 Escape character is '^]'.
 220 aeftpd dev
 help
 214-The following commands are recognized:
 214-ECHO HELP
 214 Direct comments to devnull@bogus
 help help
 214 Syntax: HELP [<sp> command]
 help echo
 214 Syntax: ECHO <SP> text
 help bogus
 502 Unknown command
 quit
 221 Goodbye
 Connection closed by foreign host.

DESCRIPTION

This role provides a standard FTP HELP command. It finds any FTP commands (cmd_*) you have defined in your context class and the associated usage functions (help_*) and implements the HELP command for you.

AUTHOR

Author: Graham Ollis <plicease@cpan.org>

Contributors:

Ryo Okamoto

Shlomi Fish

José Joaquín Atria

COPYRIGHT AND LICENSE

This software is copyright (c) 2017-2021 by Graham Ollis.

This is free software; you can redistribute it and/or modify it under the same terms as the Perl 5 programming language system itself.