Amazon-SQS-Simple

 view release on metacpan or  search on metacpan

lib/Amazon/SQS/Simple/Base.pm  view on Meta::CPAN


use strict;
use warnings;
use Carp qw( croak carp );
use Digest::SHA qw(hmac_sha256 sha256);
use LWP::UserAgent;
use MIME::Base64;
use URI::Escape;
use XML::Simple;
use HTTP::Date;
use HTTP::Request::Common;
use AWS::Signature4;
use POSIX qw(strftime);
use Encode qw(encode);
use Data::Dumper;
use Time::HiRes;
use VM::EC2::Security::CredentialCache;

use base qw(Exporter);

use constant ({ 

lib/Amazon/SQS/Simple/Base.pm  view on Meta::CPAN

        Version             => $self->{Version},
        %$params
    };

    if (!$params->{Timestamp} && !$params->{Expires}) {
        $params->{Timestamp} = _timestamp();
    }

    foreach my $try (1..MAX_RETRIES) {	
        
        my $req = HTTP::Request->new(POST => $url);
        $req->header(host => URI->new($url)->host);
        my $now = time;
        my $http_date = strftime('%Y%m%dT%H%M%SZ', gmtime($now));
        my $date = strftime('%Y%m%d', gmtime($now));
        
        $req->protocol('HTTP/1.1');
        $req->header('Date' => $http_date);
        $req->header('x-amz-target', 'AmazonSQSv20121105.' . $params->{Action});
        $req->header('content-type' => 'application/x-www-form-urlencoded;charset=utf-8');



( run in 1.191 second using v1.01-cache-2.11-cpan-de7293f3b23 )