Slackware::Slackget::Network::Connection::FTP - This class encapsulate Net::FTP


Slackware-Slackget documentation  | view source Contained in the Slackware-Slackget distribution.

Index


NAME

Top

Slackware::Slackget::Network::Connection::FTP - This class encapsulate Net::FTP

VERSION

Top

Version 1.0.0

SYNOPSIS

Top

This class encapsulate Net::FTP, and provide some methods for the treatment of FTP requests.

This class need the following extra CPAN modules :

	- Net::FTP
	- Time::HiRes

    use Slackware::Slackget::Network::Connection::FTP;

    my $foo = Slackware::Slackget::Network::Connection::FTP->new();
    ...

CONSTRUCTOR

Top

new

This class is not designed to be instanciate alone or used alone. You have to use the Slackware::Slackget::Network::Connection.

FUNCTIONS

Top

__test_server

This method test the rapidity of the mirror, by making a new connection to the server and logging in. Be aware of the fact that after testing the connection you will have a new connection (if you were previously connected the previous connection is closed).

	my $time = $connection->test_server() ;

_test_current_directory [PRIVATE]

This private methos is used internally each time you require a transfert, for testing if the current directory is the 'path' parameter of the DATA section of the current Connection object.

Do that by sending a PWD command to the server and compare the result with $connection->path.

	$ftp->cwd('/any/remote/directory/') unless($connection->_test_current_directory) ;

Due to the fact that this method is private and internal the example is not really explicit, please look at the code for more informations.

__get_file

Download and return a given file.

	my $file = $connection->get_file('PACKAGES.TXT') ;

Please note that the Net::FTP module doesn't support a method like that. So, this method is not an encapsulator like the one of HTTP.pm, and use Slackware::Slackget::File to return the content of the downloaded file.

So you'd better to use fetch_file().

__fetch_file

Download and store a given file.

	$connection->fetch_file() ; # download the file $connection->file and store it at $config->{common}->{'update-directory'}/$connection->file, this way is not recommended
	or
	$connection->fetch_file($remote_file) ; # download the file $remote_file and store it at $config->{common}->{'update-directory'}/$connection->file, this way is not recommended
	or
	$connection->fetch_file('PACKAGES.TXT',"$config->{common}->{'update-directory'}/".$current_specialfilecontainer_object->id."/PACKAGES.TXT") ; # This is the recommended way.
	# This is equivalent to : $connection->fetch_file($remote_file,$local_file) ;

This method return a Slackware::Slackget::Status object with the following object declaration :

	my $status =  Slackware::Slackget::Status->new(codes => {
		0 => "All goes well.\n",
		1 => "An error occured "
	});




__fetch_all

This method fetch all files declare in the "files" parameter of the constructor.

	$connection->fetch_all or die "Unable to fetch all files\n";

This method save all files in the $config->{common}->{'update-directory'} directory (so you have to manage yourself the files deletion/replacement problems)

conn

An accessor which return the current Net::FTP connection object

AUTHOR

Top

DUPUIS Arnaud, <a.dupuis@infinityperl.org>

BUGS

Top

Please report any bugs or feature requests to bug-Slackware-Slackget@rt.cpan.org, or through the web interface at http://rt.cpan.org/NoAuth/ReportBug.html?Queue=Slackware-Slackget. I will be notified, and then you'll automatically be notified of progress on your bug as I make changes.

SUPPORT

Top

You can find documentation for this module with the perldoc command.

    perldoc Slackware::Slackget




You can also look for information at:

* Infinity Perl website

http://www.infinityperl.org

* slack-get specific website

http://slackget.infinityperl.org

* RT: CPAN's request tracker

http://rt.cpan.org/NoAuth/Bugs.html?Dist=Slackware-Slackget

* AnnoCPAN: Annotated CPAN documentation

http://annocpan.org/dist/Slackware-Slackget

* CPAN Ratings

http://cpanratings.perl.org/d/Slackware-Slackget

* Search CPAN

http://search.cpan.org/dist/Slackware-Slackget

ACKNOWLEDGEMENTS

Top

Thanks to Bertrand Dupuis (yes my brother) for his contribution to the documentation.

COPYRIGHT & LICENSE

Top


Slackware-Slackget documentation  | view source Contained in the Slackware-Slackget distribution.