3 # Created by: Adam Jacob, Marchex, <adam@marchex.com>
4 # Created on: 10/16/2006 11:11:25 AM PDT
14 use Params::Validate qw(:all);
18 my %p = validate( @_, { content_type => { type => SCALAR }, }, );
20 'ua' => LWP::UserAgent->new,
21 'content_type' => $p{'content_type'},
27 my @non_data_methods = qw(GET DELETE OPTIONS);
28 foreach my $method (@non_data_methods) {
30 my $sub = lc($method);
33 my %p = validate( @_, { url => { type => SCALAR }, }, );
34 my $req = HTTP::Request->new( "$method" => $p{'url'} );
35 $req->content_type( $self->{'content_type'} );
40 my @data_methods = qw(PUT POST);
41 foreach my $method (@data_methods) {
43 my $sub = lc($method);
49 url => { type => SCALAR },
53 my $req = HTTP::Request->new( "$method" => $p{'url'} );
54 $req->content_type( $self->{'content_type'} );
56 do { use bytes; length( $p{'data'} ) }
58 $req->content( $p{'data'} );