Aliyun

 view release on metacpan or  search on metacpan

lib/AuthV2.pm  view on Meta::CPAN

package Aliyun::AuthV2;
use Crypt::Digest::MD5 qw(md5_hex);
use URI::Escape;
use Data::Dumper qw/Dumper/;
use DateTime;
use DateTime::Format::Strptime qw();
use Hash::Merge;
use version;
our $VERSION = 0.2;

#阿里云API签名
sub new {
    my $class = shift;
    $class = (ref $class) || $class || __PACKAGE__;
    my $self = bless {}, $class;
    $self->{'aliyun_url'} = 'http://gw.api.taobao.com/router/rest';

lib/AuthV2.pm  view on Meta::CPAN


sub set_partner_id {
    $_[0]->{'set_partner_id'} = $_[1];
}

sub _get_public_params {
    my $public_params = {
        'app_key'     => $_[0]->{'app_key'},
        'sign_method' => 'md5',
        'timestamp'   =>
        DateTime::Format::Strptime->new(pattern => '%Y-%m-%d %H:%M:%S')->format_datetime(DateTime->now(time_zone =>
            'local')),
        'format'      => 'json',
        'v'           => '2.0',
    };
    foreach ('set_target_app_key', 'set_session', 'set_partner_id') {
        if ($self->{$_}) {
            $public_params->{$_} = $self->{$_};
        }
    }
    return $public_params;



( run in 0.283 second using v1.01-cache-2.11-cpan-05444aca049 )