AnyEvent-HTTP-Message
view release on metacpan or search on metacpan
lib/AnyEvent/HTTP/Request.pm view on Meta::CPAN
# vim: set ts=2 sts=2 sw=2 expandtab smarttab:
#
# This file is part of AnyEvent-HTTP-Message
#
# This software is copyright (c) 2012 by Randy Stauner.
#
# This is free software; you can redistribute it and/or modify it under
# the same terms as the Perl 5 programming language system itself.
#
use strict;
use warnings;
package AnyEvent::HTTP::Request;
{
$AnyEvent::HTTP::Request::VERSION = '0.302';
}
BEGIN {
$AnyEvent::HTTP::Request::AUTHORITY = 'cpan:RWSTAUNER';
}
# ABSTRACT: HTTP Request object for AnyEvent::HTTP
use parent 'AnyEvent::HTTP::Message';
sub new {
my $class = shift;
my $self = $class->SUPER::new(@_);
$self->{method} = uc $self->{method};
return $self;
}
sub parse_args {
my $self = shift;
$self->_error(
q[expects an odd number of arguments:],
q[($method, $uri, (key => value, ...)*, \&callback)]
)
unless @_ & 1; ## no critic BitwiseOperators
my $args = {
method => shift,
uri => shift,
cb => pop,
params => { @_ },
};
# remove these from params
$args->{$_} = delete $args->{params}{$_}
for qw( body headers );
return $args;
}
sub from_http_message {
my ($self, $req, $extra) = @_;
my $args = {
( run in 0.466 second using v1.01-cache-2.11-cpan-5b529ec07f3 )