Meta::Utils::Net::Ftp - object to enhance Net::FTP.


Meta documentation  | view source Contained in the Meta distribution.

Index


NAME

Top

Meta::Utils::Net::Ftp - object to enhance Net::FTP.

COPYRIGHT

Top

LICENSE

Top

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, USA.

DETAILS

Top

	MANIFEST: Ftp.pm
	PROJECT: meta
	VERSION: 0.16

SYNOPSIS

Top

	package foo;
	use Meta::Utils::Net::Ftp qw();
	my($object)=Meta::Utils::Net::Ftp->new();
	my($result)=$object->method();

DESCRIPTION

Top

This object is here to enhance the Net::FTP object which is out there for perl.

Note: it would have been convenient to just inherit from Net::FTP but Net::FTP is not a hash. Therefore we just store Net::FTP internally.

Another solution would be to route methods to that class using Meta::Class::MethodMaker which I plan to do in the future.

FUNCTIONS

Top

	BEGIN()
	do_login($)
	do_logout($)
	do_put_mkdir($$$)
	get_fs_1($)
	get_fs_2($)
	get_fs_3($)
	get_mdtm($$$)
	do_delete($$)
	do_rmdir($$)
	do_cwd($$)
	TEST($)

FUNCTION DOCUMENTATION

Top

BEGIN()

This is an initialization code which creates get/set methods for the following attributes: ftp - the Net::FTP object that this object uses. site - the remote site. debug - set debugging ?. name - user name for the remote site. password - password at the remote site. mode - the transfer mode (text/binary) for the current session.

do_login($)

This will login into the remote host.

do_logout($)

This will logout the session.

put_mkdir($$$)

This method uploads a file to the ftp archive and creates a directory if it is neccessary.

get_fs_1($)

This method returns a Meta::Utils::File::Fs object which represents remote site. See that objects documentation about what you can do with it. The methos is to issue an "ls -R" command to the server and parse the results. Each directory is postfixed by a ":" and the files are not. The output from an ls -R command is far from satisfactory for what I'm doing here so the code here is coyote ugly. Don't mind it cause it does it's job in the cases where we need them. If you feel that you need something better It's probably a good idea to write code to recurse the site yourself or find a better command to list the entire content of the site.

get_fs_2($)

This method returns a Meta::Utils::File::Fs object which represents remote site. See that objects documentation about what you can do with it. The methos is to issue an "ls -R" command to the server and parse the results. Each directory is postfixed by a ":" and the files are not. The output from an ls -R command is far from satisfactory for what I'm doing here so the code here is coyote ugly. Don't mind it cause it does it's job in the cases where we need them. If you feel that you need something better It's probably a good idea to write code to recurse the site yourself or find a better command to list the entire content of the site.

get_fs_3()

This method gets a file system using the dir("-R") method.

get_mdtm($$$

This method receives an ftp type object and an Fs type object. The method will fill all modification times for the Fs from the remote serves by issuing mdtm commands. Mind you, this method only gets times for files and not directories.

do_delete($$)

Remove a file from the remote FTP archive.

do_rmdir($$)

This method will remove a directory on the remote FTP archive for you. Take heed that the error checking code in this routine is disabled because the rmdir routine sometimes returns a fail value when the request is legal and is even executed well!!! (is that a problem on my end with version of perl compiler or something ?)

do_cwd($$)

This method does a cwd command.

TEST($)

Test suite for this module.

SUPER CLASSES

Top

None.

BUGS

Top

None.

AUTHOR

Top

	Name: Mark Veltzer
	Email: mailto:veltzer@cpan.org
	WWW: http://www.veltzer.org
	CPAN id: VELTZER

HISTORY

Top

	0.00 MV upload system revamp
	0.01 MV do some book work
	0.02 MV writing papers
	0.03 MV perl packaging
	0.04 MV xml
	0.05 MV PDMT
	0.06 MV md5 project
	0.07 MV database
	0.08 MV perl module versions in files
	0.09 MV movies and small fixes
	0.10 MV thumbnail user interface
	0.11 MV more thumbnail issues
	0.12 MV website construction
	0.13 MV web site development
	0.14 MV web site automation
	0.15 MV SEE ALSO section fix
	0.16 MV md5 issues

SEE ALSO

Top

Error(3), Meta::Class::MethodMaker(3), Meta::Utils::File::Fs(3), Meta::Utils::Output(3), Meta::Utils::System(3), Net::FTP(3), strict(3)

TODO

Top

-make the get_fs_3 routine also set the modification times (will save runtime).

-make the get_fs_3 more robust (the regular expressions there for paring the output of dir("-R") are a little too much...

-return the error checking code into the do_rmdir method. It's just that some FTP servers return a "fail" value when they haven't failed in removing the remote directory.

-route methods to Net::FTP using MethodMaker or something.


Meta documentation  | view source Contained in the Meta distribution.