Slackware::Slackget::Network::Connection::HTTP - This class encapsulate LWP::Simple


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

Index


NAME

Top

Slackware::Slackget::Network::Connection::HTTP - This class encapsulate LWP::Simple

VERSION

Top

Version 1.0.0

SYNOPSIS

Top

This class encapsulate LWP::Simple, and provide some methods for the treatment of HTTP requests.

You can't use this class without the Slackware::Slackget::Network::Connection one.

This class need the following extra CPAN modules :

	- LWP::Simple
	- Time::HiRes

    use Slackware::Slackget::Network::Connection::HTTP;

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

This module require the following modules from CPAN : LWP::Simple, Time::HiRes.

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 timing a head request on the FILELIST.TXT file.

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

__get_file

Download and return a given file.

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

__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 $state =  Slackware::Slackget::Status->new(codes => {
		0 => "All goes well.<br/> Server said: <br/>$ret_code - ".status_message( $ret_code ),
		1 => "Server error, you must choose the next host for this server.<br/> Server said: $ret_code - $tmp_status_message",
		2 => "Client error, it seems that you have a problem with you connection or with the slackget10 library <br/>(or with a library which we depended on). It is also possible that the file we try to download was not on the remote server.<br/> Server said: <br/>$ret_code - $tmp_status_message",
		3 => "Server has redirected us, we prefer direct connection, change host for this server.<br/> Server said: <br/>$ret_code - $tmp_status_message",
		4 => "The HTTP connection is not a success and we are not able to know what, we recommend to change the current host of this server.<br/> Server said: <br/>$ret_code - $tmp_status_message"
	});

This is the direct code of this method :)

__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)

__download

This method is introduced with the 0.11 release of slackget10 and is the one used to emulate POE behaviour.

This method is here in order to simplify the migration to the new POE based architecture.

download() take only one argument : a file to download and it will call all needed InlineStates when it's possible.

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/category/slack-get

* 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.