ViewVC Help
View File | Revision Log | Show Annotations | Download File
/cvs/AnyEvent-HTTP/HTTP.pm
(Generate patch)

Comparing AnyEvent-HTTP/HTTP.pm (file contents):
Revision 1.8 by root, Wed Jun 4 12:32:30 2008 UTC vs.
Revision 1.9 by root, Wed Jun 4 13:51:53 2008 UTC

126The request body, usually empty. Will be-sent as-is (future versions of 126The request body, usually empty. Will be-sent as-is (future versions of
127this module might offer more options). 127this module might offer more options).
128 128
129=back 129=back
130 130
131=back 131Example: make a simple HTTP GET request for http://www.nethype.de/
132
133 http_request GET => "http://www.nethype.de/", sub {
134 my ($body, $hdr) = @_;
135 print "$body\n";
136 };
137
138Example: make a HTTP HEAD request on https://www.google.com/, use a
139timeout of 30 seconds.
140
141 http_request
142 GET => "https://www.google.com",
143 timeout => 30,
144 sub {
145 my ($body, $hdr) = @_;
146 use Data::Dumper;
147 print Dumper $hdr;
148 }
149 ;
132 150
133=cut 151=cut
134 152
135sub http_request($$$;@) { 153sub http_request($$$;@) {
136 my $cb = pop; 154 my $cb = pop;
317sub http_post($$$;@) { 335sub http_post($$$;@) {
318 unshift @_, "POST", "body"; 336 unshift @_, "POST", "body";
319 &http_request 337 &http_request
320} 338}
321 339
340=back
341
322=head2 GLOBAL FUNCTIONS AND VARIABLES 342=head2 GLOBAL FUNCTIONS AND VARIABLES
323 343
324=over 4 344=over 4
325 345
326=item AnyEvent::HTTP::set_proxy "proxy-url" 346=item AnyEvent::HTTP::set_proxy "proxy-url"

Diff Legend

Removed lines
+ Added lines
< Changed lines
> Changed lines