3 # Created by: Adam Jacob, Marchex, <adam@hjksolutions.com>
4 # Created on: 10/16/2006 11:11:25 AM PDT
14 use Params::Validate qw(:all);
18 my %p = validate( @_, {
19 content_type => { type => SCALAR },
23 'ua' => LWP::UserAgent->new,
24 'content_type' => $p{'content_type'},
30 my @non_data_methods = qw(GET DELETE OPTIONS);
31 foreach my $method (@non_data_methods) {
33 my $sub = lc($method);
36 my %p = validate( @_, { url => { type => SCALAR }, }, );
37 my $req = HTTP::Request->new( "$method" => $p{'url'} );
38 $req->content_type( $self->{'content_type'} );
43 my @data_methods = qw(PUT POST);
44 foreach my $method (@data_methods) {
46 my $sub = lc($method);
52 url => { type => SCALAR },
56 my $req = HTTP::Request->new( "$method" => $p{'url'} );
57 $req->content_type( $self->{'content_type'} );
59 do { use bytes; length( $p{'data'} ) }
61 $req->content( $p{'data'} );