4 use namespace::autoclean;
7 use Params::Validate qw(:all);
11 my %p = validate( @_, {
12 content_type => { type => SCALAR },
16 'ua' => LWP::UserAgent->new,
17 'content_type' => $p{'content_type'},
23 my @non_data_methods = qw(GET DELETE OPTIONS);
24 foreach my $method (@non_data_methods) {
26 my $sub = lc($method);
29 my %p = validate( @_, { url => { type => SCALAR }, }, );
30 my $req = HTTP::Request->new( "$method" => $p{'url'} );
31 $req->content_type( $self->{'content_type'} );
36 my @data_methods = qw(PUT POST);
37 foreach my $method (@data_methods) {
39 my $sub = lc($method);
45 url => { type => SCALAR },
49 my $req = HTTP::Request->new( "$method" => $p{'url'} );
50 $req->content_type( $self->{'content_type'} );
52 do { use bytes; length( $p{'data'} ) }
54 $req->content( $p{'data'} );