view release on metacpan or search on metacpan
--- #YAML:1.0
name: AWS-CloudFront
version: 0.003
abstract: Lightweight interface to Amazon CloudFront CDN
author:
- John Drago <jdrago_999@yahoo.com>
license: perl
distribution_type: module
test_requires:
Test::More: 0
requires:
AWS::S3: 0.023
Carp: 0
LWP::UserAgent: 0
Digest::HMAC_SHA1: 0
inc/Module/Install.pm view on Meta::CPAN
#line 1
package Module::Install;
# For any maintainers:
# The load order for Module::Install is a bit magic.
# It goes something like this...
#
# IF ( host has Module::Install installed, creating author mode ) {
# 1. Makefile.PL calls "use inc::Module::Install"
# 2. $INC{inc/Module/Install.pm} set to installed version of inc::Module::Install
# 3. The installed version of inc::Module::Install loads
# 4. inc::Module::Install calls "require Module::Install"
# 5. The ./inc/ version of Module::Install loads
# } ELSE {
# 1. Makefile.PL calls "use inc::Module::Install"
# 2. $INC{inc/Module/Install.pm} set to ./inc/ version of Module::Install
# 3. The ./inc/ version of Module::Install loads
# }
inc/Module/Install.pm view on Meta::CPAN
};
}
sub import {
my $class = shift;
my $self = $class->new(@_);
my $who = $self->_caller;
unless ( -f $self->{file} ) {
require "$self->{path}/$self->{dispatch}.pm";
File::Path::mkpath("$self->{prefix}/$self->{author}");
$self->{admin} = "$self->{name}::$self->{dispatch}"->new( _top => $self );
$self->{admin}->init;
@_ = ($class, _self => $self);
goto &{"$self->{name}::import"};
}
*{"${who}::AUTOLOAD"} = $self->autoload;
$self->preload;
# Unregister loader and worker packages so subdirs can use them again
inc/Module/Install.pm view on Meta::CPAN
# ignore the prefix on extension modules built from top level.
my $base_path = Cwd::abs_path($FindBin::Bin);
unless ( Cwd::abs_path(Cwd::cwd()) eq $base_path ) {
delete $args{prefix};
}
return $args{_self} if $args{_self};
$args{dispatch} ||= 'Admin';
$args{prefix} ||= 'inc';
$args{author} ||= ($^O eq 'VMS' ? '_author' : '.author');
$args{bundle} ||= 'inc/BUNDLES';
$args{base} ||= $base_path;
$class =~ s/^\Q$args{prefix}\E:://;
$args{name} ||= $class;
$args{version} ||= $class->VERSION;
unless ( $args{path} ) {
$args{path} = $args{name};
$args{path} =~ s!::!/!g;
}
$args{file} ||= "$args{base}/$args{prefix}/$args{path}.pm";
inc/Module/Install/Makefile.pm view on Meta::CPAN
my $args = $self->makemaker_args;
$args->{DISTNAME} = $self->name;
$args->{NAME} = $self->module_name || $self->name;
$args->{VERSION} = $self->version;
$args->{NAME} =~ s/-/::/g;
if ( $self->tests ) {
$args->{test} = { TESTS => $self->tests };
}
if ($] >= 5.005) {
$args->{ABSTRACT} = $self->abstract;
$args->{AUTHOR} = $self->author;
}
if ( eval($ExtUtils::MakeMaker::VERSION) >= 6.10 ) {
$args->{NO_META} = 1;
}
if ( eval($ExtUtils::MakeMaker::VERSION) > 6.17 and $self->sign ) {
$args->{SIGN} = 1;
}
unless ( $self->is_admin ) {
delete $args->{SIGN};
}
inc/Module/Install/Metadata.pm view on Meta::CPAN
BEGIN {
$VERSION = '0.79';
$ISCORE = 1;
@ISA = qw{Module::Install::Base};
}
my @scalar_keys = qw{
name
module_name
abstract
author
version
distribution_type
tests
installdirs
};
my @tuple_keys = qw{
configure_requires
build_requires
requires
inc/Module/Install/Metadata.pm view on Meta::CPAN
# Some methods pull from POD instead of code.
# If there is a matching .pod, use that instead
my $pod = $file;
$pod =~ s/\.pm$/.pod/i;
$pod = $file unless -e $pod;
# Pull the different values
$self->name_from($file) unless $self->name;
$self->version_from($file) unless $self->version;
$self->perl_version_from($file) unless $self->perl_version;
$self->author_from($pod) unless $self->author;
$self->license_from($pod) unless $self->license;
$self->abstract_from($pod) unless $self->abstract;
return 1;
}
sub provides {
my $self = shift;
my $provides = ( $self->{values}{provides} ||= {} );
%$provides = (%$provides, @_) if @_;
inc/Module/Install/Metadata.pm view on Meta::CPAN
) {
my $perl_version = $1;
$perl_version =~ s{_}{}g;
$self->perl_version($perl_version);
} else {
warn "Cannot determine perl version info from $_[0]\n";
return;
}
}
sub author_from {
my $self = shift;
my $content = Module::Install::_read($_[0]);
if ($content =~ m/
=head \d \s+ (?:authors?)\b \s*
([^\n]*)
|
=head \d \s+ (?:licen[cs]e|licensing|copyright|legal)\b \s*
.*? copyright .*? \d\d\d[\d.]+ \s* (?:\bby\b)? \s*
([^\n]*)
/ixms) {
my $author = $1 || $2;
$author =~ s{E<lt>}{<}g;
$author =~ s{E<gt>}{>}g;
$self->author($author);
} else {
warn "Cannot determine author info from $_[0]\n";
}
}
sub license_from {
my $self = shift;
if (
Module::Install::_read($_[0]) =~ m/
(
=head \d \s+
(?:licen[cs]e|licensing|copyright|legal)\b
lib/AWS/CloudFront/Request/CreateDistribution.pm view on Meta::CPAN
<Enabled>@{[ $s->Enabled ? 'true' : 'false' ]}</Enabled>
@{[ $s->DefaultRootObject ? ('<DefaultRootObject>' . $s->DefaultRootObject. '</DefaultRootObject>') : '' ]}
@{[ $s->_logging_xml ]}
</DistributionConfig>
XML
my $signer = AWS::CloudFront::Signer->new(
cf => $s->cf,
);
$s->_send_request( 'POST' => $uri => {
Authorization => $signer->auth_header,
'x-amz-date' => $signer->date,
}, $xml);
}# end request()
sub parse_response
{
my ($s, $res) = @_;
AWS::CloudFront::ResponseParser->new(
response => $res,
lib/AWS/CloudFront/Request/CreateOriginAccessIdentity.pm view on Meta::CPAN
<CloudFrontOriginAccessIdentityConfig xmlns="http://cloudfront.amazonaws.com/doc/2010-11-01/">
<CallerReference>@{[ $s->CallerReference ]}</CallerReference>
<Comment>@{[ $s->Comment ]}</Comment>
</CloudFrontOriginAccessIdentityConfig>
XML
my $signer = AWS::CloudFront::Signer->new(
cf => $s->cf,
);
$s->_send_request( 'POST' => $uri => {
Authorization => $signer->auth_header,
'x-amz-date' => $signer->date,
}, $xml);
}# end request()
sub parse_response
{
my ($s, $res) = @_;
AWS::CloudFront::ResponseParser->new(
response => $res,
lib/AWS/CloudFront/Request/DeleteDistribution.pm view on Meta::CPAN
{
my $s = shift;
# First get the etag:
my $etag = (sub{
my $uri = 'https://cloudfront.amazonaws.com/2010-11-01/distribution/' . $s->Id;
my $signer = AWS::CloudFront::Signer->new(
cf => $s->cf,
);
my $res = $s->_send_request( 'GET' => $uri => {
Authorization => $signer->auth_header,
'x-amz-date' => $signer->date,
});
return $res->response->header('etag');
})->();
# Now we can delete the distribution:
my $uri = 'https://cloudfront.amazonaws.com/2010-11-01/distribution/' . $s->Id;
my $signer = AWS::CloudFront::Signer->new(
cf => $s->cf,
);
my $res = $s->_send_request( 'DELETE' => $uri => {
Authorization => $signer->auth_header,
'x-amz-date' => $signer->date,
'if-match' => $etag,
});
}# end request()
sub parse_response
{
my ($s, $res) = @_;
AWS::CloudFront::ResponseParser->new(
lib/AWS/CloudFront/Request/GetDistribution.pm view on Meta::CPAN
sub request
{
my $s = shift;
my $uri = 'https://cloudfront.amazonaws.com/2010-11-01/distribution/' . $s->Id;
my $signer = AWS::CloudFront::Signer->new(
cf => $s->cf,
);
$s->_send_request( 'GET' => $uri => {
Authorization => $signer->auth_header,
'x-amz-date' => $signer->date,
});
}# end request()
sub parse_response
{
my ($s, $res) = @_;
AWS::CloudFront::ResponseParser->new(
response => $res,
lib/AWS/CloudFront/Request/GetDistributionList.pm view on Meta::CPAN
sub request
{
my $s = shift;
my $uri = 'https://cloudfront.amazonaws.com/2010-11-01/distribution';
my $signer = AWS::CloudFront::Signer->new(
cf => $s->cf,
);
$s->_send_request( 'GET' => $uri => {
Authorization => $signer->auth_header,
'x-amz-date' => $signer->date,
});
}# end request()
sub parse_response
{
my ($s, $res) = @_;
AWS::CloudFront::ResponseParser->new(
response => $res,
lib/AWS/CloudFront/Request/GetOriginAccessIdentity.pm view on Meta::CPAN
sub request
{
my $s = shift;
my $uri = 'https://cloudfront.amazonaws.com/2010-11-01/origin-access-identity/cloudfront/' . $s->Id;
my $signer = AWS::CloudFront::Signer->new(
cf => $s->cf,
);
$s->_send_request( 'GET' => $uri => {
Authorization => $signer->auth_header,
'x-amz-date' => $signer->date,
});
}# end request()
sub parse_response
{
my ($s, $res) = @_;
AWS::CloudFront::ResponseParser->new(
response => $res,
lib/AWS/CloudFront/Request/GetOriginAccessIdentityList.pm view on Meta::CPAN
my $uri = 'https://cloudfront.amazonaws.com/2010-11-01/origin-access-identity/cloudfront';
my @params = ( );
push @params, 'Marker=' . $s->Marker if defined $s->Marker;
push @params, 'MaxItems=' . $s->MaxItems if defined $s->MaxItems;
$uri .= '?' . join('&', @params) if @params;
my $signer = AWS::CloudFront::Signer->new(
cf => $s->cf,
);
$s->_send_request( 'GET' => $uri => {
Authorization => $signer->auth_header,
'x-amz-date' => $signer->date,
});
}# end request()
sub parse_response
{
my ($s, $res) = @_;
AWS::CloudFront::ResponseParser->new(
response => $res,
lib/AWS/CloudFront/Request/UpdateDistribution.pm view on Meta::CPAN
{
my $s = shift;
# First get the etag:
my $etag = (sub{
my $uri = 'https://cloudfront.amazonaws.com/2010-11-01/distribution/' . $s->d->Id;
my $signer = AWS::CloudFront::Signer->new(
cf => $s->cf,
);
my $res = $s->_send_request( 'GET' => $uri => {
Authorization => $signer->auth_header,
'x-amz-date' => $signer->date,
});
return $res->response->header('etag');
})->();
my $uri = 'https://cloudfront.amazonaws.com/2010-11-01/distribution/' . $s->d->Id . '/config';
my $xml = <<"XML";
<?xml version="1.0" encoding="UTF-8"?>
<DistributionConfig xmlns="http://cloudfront.amazonaws.com/doc/2010-11-01/">
lib/AWS/CloudFront/Request/UpdateDistribution.pm view on Meta::CPAN
<Enabled>@{[ $s->d->Enabled ? 'true' : 'false' ]}</Enabled>
@{[ $s->d->DefaultRootObject ? ('<DefaultRootObject>' . $s->d->efaultRootObject. '</DefaultRootObject>') : '' ]}
@{[ $s->_logging_xml ]}
</DistributionConfig>
XML
my $signer = AWS::CloudFront::Signer->new(
cf => $s->d->cf,
);
$s->_send_request( 'POST' => $uri => {
Authorization => $signer->auth_header,
'x-amz-date' => $signer->date,
'if-match' => $etag,
}, $xml);
}# end request()
sub parse_response
{
my ($s, $res) = @_;
AWS::CloudFront::ResponseParser->new(
lib/AWS/CloudFront/Signer.pm view on Meta::CPAN
isa => 'Str',
required => 1,
lazy => 1,
default => sub {
my $s = shift;
encode_base64(hmac_sha1($s->date, $s->cf->secret_access_key));
}
);
sub auth_header
{
my $s = shift;
return 'AWS ' . $s->cf->access_key_id . ':' . $s->signature;
}# end auth_header()
sub _urlencode
{
my ($unencoded ) = @_;
return uri_escape_utf8( $unencoded, '^A-Za-z0-9_-' );
}# end _urlencode()
1;# return true: