NAME POE::Declare::HTTP::Client - A simple HTTP client based on POE::Declare SYNOPSIS # Create the web server my $http = POE::Declare::HTTP::Client->new( Hostname => '127.0.0.1', Port => '80', Handler => sub { my $server = shift; my $response = shift; # The request is not passed to you but is available if needed my $request = $response->request; # Webby content generation stuff here $response->code( 200 ); $response->header( 'Content-Type' => 'text/plain' ); $response->content( "Hello World!" ); return; }, ); # Control with methods $http->start; $http->stop; DESCRIPTION This module provides a simple HTTP client based on POE::Declare. The implemenetation is intentionally minimalist, making this module an ideal choice for creating specialised web clients embedded in larger applications. METHODS new my $server = POE::Declare::HTTP::Client->new( ResponseEvent => \&on_response, ShutdownEvent => \&on_shutdown, ); The "new" constructor sets up a reusable HTTP client that can be enabled and disabled repeatedly as needed. start The "start" method enables the web server. If the server is already running, this method will shortcut and do nothing. If called before POE has been started, the web server will start immediately once POE is running. stop The "stop" method disables the web server. If the server is not running, this method will shortcut and do nothing. get $client->get('http://www.cpan.org/'); The "get" method fetches a named URL via an HTTP GET. post $client->post('http://www.cpan.org/'); The "get" method fetches a named URL via an HTTP POST. request $client->request( $request_object ); running The boolean "running" method returns true if the client is both spawned and processing a request, or false if not. Note that it does not distinguish between running and idle, and stopped entirely. SUPPORT Bugs should be always be reported via the CPAN bug tracker at <http://rt.cpan.org/NoAuth/ReportBug.html?Queue=POE-Declare-HTTP-Client> For other issues, or commercial enhancement or support, contact the author. AUTHORS Adam Kennedy <adamk@cpan.org> SEE ALSO POE, <http://ali.as/> COPYRIGHT Copyright 2006 - 2011 Adam Kennedy. This program is free software; you can redistribute it and/or modify it under the same terms as Perl itself. The full text of the license can be found in the LICENSE file included with this module.