POE::Component::Client::HTTP

POE::Component::Client::HTTP is a HTTP user-agent component.
Download

POE::Component::Client::HTTP Ranking & Summary

Advertisement

  • Rating:
  • License:
  • Perl Artistic License
  • Price:
  • FREE
  • Publisher Name:
  • Rocco Caputo
  • Publisher web site:
  • http://search.cpan.org/~apocal/

POE::Component::Client::HTTP Tags


POE::Component::Client::HTTP Description

POE::Component::Client::HTTP is a HTTP user-agent component. POE::Component::Client::HTTP is a HTTP user-agent component.SYNOPSIS use POE qw(Component::Client::HTTP); POE::Component::Client::HTTP->spawn( Agent => 'SpiffCrawler/0.90', # defaults to something long Alias => 'ua', # defaults to 'weeble' From => 'spiffster@perl.org', # defaults to undef (no header) Protocol => 'HTTP/0.9', # defaults to 'HTTP/1.1' Timeout => 60, # defaults to 180 seconds MaxSize => 16384, # defaults to entire response Streaming => 4096, # defaults to 0 (off) FollowRedirects => 2 # defaults to 0 (off) Proxy => "http://localhost:80", # defaults to HTTP_PROXY env. variable NoProxy => , # defs to NO_PROXY env. variable ); $kernel->post( 'ua', # posts to the 'ua' alias 'request', # posts to ua's 'request' state 'response', # which of our states will receive the response $request, # an HTTP::Request object ); # This is the sub which is called when the session receives a # 'response' event. sub response_handler { my ($request_packet, $response_packet) = @_; # HTTP::Request my $request_object = $request_packet->; # HTTP::Response my $response_object = $response_packet->; my $stream_chunk; if (! defined($response_object->content)) { $stream_chunk = $response_packet->; } print( "*" x 78, "n", "*** my request:n", "-" x 78, "n", $request_object->as_string(), "*" x 78, "n", "*** their response:n", "-" x 78, "n", $response_object->as_string(), ); if (defined $stream_chunk) { print "-" x 40, "n", $stream_chunk, "n"; } print "*" x 78, "n"; }POE::Component::Client::HTTP is an HTTP user-agent for POE. It lets other sessions run while HTTP transactions are being processed, and it lets several HTTP transactions be processed in parallel.If POE::Component::Client::DNS is also installed, Client::HTTP will use it to resolve hosts without blocking. Otherwise it will use gethostbyname(), which may have performance problems.HTTP client components are not proper objects. Instead of being created, as most objects are, they are "spawned" as separate sessions. To avoid confusion (and hopefully not cause other confusion), they must be spawned with a spawn method, not created anew with a new one. Requirements: · Perl


POE::Component::Client::HTTP Related Software