| line | stmt | bran | cond | sub | pod | time | code | 
| 1 |  |  |  |  |  |  | package WWW::betfair::Request; | 
| 2 | 1 |  |  | 1 |  | 5 | use strict; | 
|  | 1 |  |  |  |  | 2 |  | 
|  | 1 |  |  |  |  | 33 |  | 
| 3 | 1 |  |  | 1 |  | 5 | use warnings; | 
|  | 1 |  |  |  |  | 2 |  | 
|  | 1 |  |  |  |  | 24 |  | 
| 4 | 1 |  |  | 1 |  | 3419 | use LWP::UserAgent; | 
|  | 1 |  |  |  |  | 69850 |  | 
|  | 1 |  |  |  |  | 37 |  | 
| 5 | 1 |  |  | 1 |  | 13 | use HTTP::Request; | 
|  | 1 |  |  |  |  | 3 |  | 
|  | 1 |  |  |  |  | 142 |  | 
| 6 |  |  |  |  |  |  |  | 
| 7 |  |  |  |  |  |  | =head2 new_request | 
| 8 |  |  |  |  |  |  |  | 
| 9 |  |  |  |  |  |  | Sends HTTP requests to the betfair API and parses the returning XML into a Perl hashreference. | 
| 10 |  |  |  |  |  |  |  | 
| 11 |  |  |  |  |  |  | =cut | 
| 12 |  |  |  |  |  |  |  | 
| 13 |  |  |  |  |  |  |  | 
| 14 |  |  |  |  |  |  | sub new_request | 
| 15 |  |  |  |  |  |  | { | 
| 16 | 0 |  |  | 0 | 1 |  | my ($uri, $action, $xmlmessage) = @_; | 
| 17 |  |  |  |  |  |  |  | 
| 18 |  |  |  |  |  |  | # build and send request | 
| 19 | 0 |  |  |  |  |  | my $userAgent = LWP::UserAgent->new; | 
| 20 | 0 |  |  |  |  |  | $userAgent->env_proxy; | 
| 21 | 0 |  |  |  |  |  | my $request = HTTP::Request->new( POST => $uri ); | 
| 22 | 0 |  |  |  |  |  | $request->header( SOAPAction => '"' . $action .'"' ); | 
| 23 | 0 |  |  |  |  |  | $request->header(Accept_Encoding => "gzip"); | 
| 24 | 0 |  |  |  |  |  | $request->content($xmlmessage); | 
| 25 | 0 |  |  |  |  |  | $request->content_type("text/xml; charset=utf-8"); | 
| 26 | 0 |  |  |  |  |  | return $userAgent->request($request); | 
| 27 |  |  |  |  |  |  | } | 
| 28 |  |  |  |  |  |  | 1; |