From 2bc8c48be031edbe96dbcdf9790855ce9578f506 Mon Sep 17 00:00:00 2001 From: Pedro Figueiredo Date: Sun, 16 Sep 2012 11:01:08 +0100 Subject: [PATCH 1/7] Changed client tests to work with Pedro's account --- t/02client.t | 12 ++++++------ 1 file changed, 6 insertions(+), 6 deletions(-) diff --git a/t/02client.t b/t/02client.t index 72389e85..8895b13e 100644 --- a/t/02client.t +++ b/t/02client.t @@ -33,11 +33,11 @@ my $client = Net::Amazon::S3::Client->new( s3 => $s3 ); my @buckets = $client->buckets; TODO: { - local $TODO = "These tests only work if you're leon"; + local $TODO = "These tests only work if you're pedro"; my $first_bucket = $buckets[0]; - like( $first_bucket->owner_id, qr/^46a801915a1711f/, 'have owner id' ); - is( $first_bucket->owner_display_name, '_acme_', 'have display name' ); - is( scalar @buckets, 10, 'have a bunch of buckets' ); + like( $first_bucket->owner_id, qr/^c7483d612ac7f0c0/, 'have owner id' ); + is( $first_bucket->owner_display_name, 'pedro_figueiredo', 'have display name' ); + is( scalar @buckets, 6, 'have a bunch of buckets' ); } my $bucket_name = 'net-amazon-s3-test-' . lc $aws_access_key_id; @@ -45,7 +45,7 @@ my $bucket_name = 'net-amazon-s3-test-' . lc $aws_access_key_id; my $bucket = $client->create_bucket( name => $bucket_name, acl_short => 'public-read', - location_constraint => 'US', + location_constraint => 'EU', ); is( $bucket->name, $bucket_name, 'newly created bucket has correct name' ); @@ -56,7 +56,7 @@ like( 'newly created bucket is public-readable' ); -is( $bucket->location_constraint, 'US', 'newly created bucket is in the US' ); +is( $bucket->location_constraint, 'EU', 'newly created bucket is in the EU' ); my $stream = $bucket->list; until ( $stream->is_done ) { From 7ffae2c5cac6fd508fb88667c2ce0d5bf083e444 Mon Sep 17 00:00:00 2001 From: Pedro Figueiredo Date: Sun, 16 Sep 2012 11:01:49 +0100 Subject: [PATCH 2/7] Added Content-Disposition to put_filename() --- lib/Net/Amazon/S3/Client/Object.pm | 6 +++++- 1 file changed, 5 insertions(+), 1 deletion(-) diff --git a/lib/Net/Amazon/S3/Client/Object.pm b/lib/Net/Amazon/S3/Client/Object.pm index b35356ab..04574326 100644 --- a/lib/Net/Amazon/S3/Client/Object.pm +++ b/lib/Net/Amazon/S3/Client/Object.pm @@ -127,7 +127,7 @@ sub put { if ( $self->content_encoding ) { $conf->{'Content-Encoding'} = $self->content_encoding; } - if ( $self->content_disposition ) { + if ( $self->content_disposition ) { $conf->{'Content-Disposition'} = $self->content_disposition; } @@ -176,6 +176,10 @@ sub put_filename { if ( $self->content_encoding ) { $conf->{'Content-Encoding'} = $self->content_encoding; } + if ( $self->content_disposition ) { + $conf->{'Content-Disposition'} = $self->content_disposition; + } + my $http_request = Net::Amazon::S3::Request::PutObject->new( s3 => $self->client->s3, From 9a30f5090a12858062a9844e3ee42fcda7a3aaaa Mon Sep 17 00:00:00 2001 From: Pedro Figueiredo Date: Sun, 16 Sep 2012 20:13:31 +0100 Subject: [PATCH 3/7] Updated docs to include Content-Disposition --- lib/Net/Amazon/S3/Client/Object.pm | 6 ++++-- 1 file changed, 4 insertions(+), 2 deletions(-) diff --git a/lib/Net/Amazon/S3/Client/Object.pm b/lib/Net/Amazon/S3/Client/Object.pm index 04574326..a409f608 100644 --- a/lib/Net/Amazon/S3/Client/Object.pm +++ b/lib/Net/Amazon/S3/Client/Object.pm @@ -406,7 +406,8 @@ This module represents objects in buckets. ); $object->put('this is the public value'); -You may also set Content-Encoding using content_encoding. +You may also set Content-Encoding using content_encoding, and +Content-Disposition using content_disposition. =head2 put_filename @@ -426,7 +427,8 @@ You may also set Content-Encoding using content_encoding. ); $object->put_filename('hat.jpg'); -You may also set Content-Encoding using content_encoding. +You may also set Content-Encoding using content_encoding, and +Content-Disposition using content_disposition. =head2 query_string_authentication_uri From 2897d9c437868f799c939f7c2f560c9bfa3371bf Mon Sep 17 00:00:00 2001 From: Pedro Figueiredo Date: Sun, 16 Sep 2012 20:56:14 +0100 Subject: [PATCH 4/7] Make Perl::Critic happy --- bin/s3cl | 12 +++++++----- 1 file changed, 7 insertions(+), 5 deletions(-) diff --git a/bin/s3cl b/bin/s3cl index e07944ae..06f0a073 100755 --- a/bin/s3cl +++ b/bin/s3cl @@ -393,14 +393,15 @@ s3cl sync_up [--acl_short=public-read] /path/ :[prefix] Upload all the files below /path/ to S3, with an optional prefix at the start of the key name. The existing S3 files and -meta data are fetched from S3 and the md5 (etag) is compaired to what is -on the local disk, files are not upload if the content has not changed. +meta data are fetched from S3 and the md5 (etag) is compaired to +what is on the local disk, files are not upload if the content has +not changed. -Use --acl_short to set access control, options from -L this is only applied when the +Use --acl_short to set access control, options from +L this is only applied when the file is uploaded. -Each files content-type is worked out using L, +Each files content-type is worked out using L, if this does not match 'text/plain' is used for ASCII text files, otherwise a warning is issued and the file is NOT uploaded. @@ -436,3 +437,4 @@ following notice (which is also applicicable to this code): Leo Lapworth - Part of the HinuHinu project =cut + From 7c018f12e63be162fc5897f51ea0c1f9873941d4 Mon Sep 17 00:00:00 2001 From: Pedro Figueiredo Date: Sun, 16 Sep 2012 20:56:44 +0100 Subject: [PATCH 5/7] Updated dzil's configuration --- dist.ini | 21 ++++++++++++++++----- 1 file changed, 16 insertions(+), 5 deletions(-) diff --git a/dist.ini b/dist.ini index 55181e48..9189a1e1 100644 --- a/dist.ini +++ b/dist.ini @@ -6,19 +6,30 @@ version = 0.57 [@Filter] -bundle = @Basic --remove = MakeMaker option = for_basic -[ModuleInstall] [MetaJSON] +[MetaResources] +bugtracker.web = https://github.com/pfig/net-amazon-s3/issues +repository.url = https://github.com/pfig/net-amazon-s3.git +repository.web = https://github.com/pfig/net-amazon-s3 +repository.type = git + [AutoPrereqs] +[CPANFile] + +[CheckChangeLog] + [PodWeaver] +[ReadmeMarkdownFromPod] + [PkgVersion] [NextRelease] filename = CHANGES format = %-4v %{ccc MMM dd HH:mm:ss vvv yyyy}d -[PodSyntaxTests] -[PodCoverageTests] -[Test::Perl::Critic] +[@TestingMania] +disable = Test::Kwalitee +[@Git] +[Git::CommitBuild] From ebbea88aa78ca6384be93335e28cff0ab83ceb8a Mon Sep 17 00:00:00 2001 From: Pedro Figueiredo Date: Sun, 16 Sep 2012 22:30:16 +0100 Subject: [PATCH 6/7] Removing link checks and POD coverage tests for the moment --- dist.ini | 2 ++ 1 file changed, 2 insertions(+) diff --git a/dist.ini b/dist.ini index 9189a1e1..ef1e6e90 100644 --- a/dist.ini +++ b/dist.ini @@ -30,6 +30,8 @@ format = %-4v %{ccc MMM dd HH:mm:ss vvv yyyy}d [@TestingMania] disable = Test::Kwalitee +disable = Test::Pod::LinkCheck +disable = PodCoverageTests [@Git] [Git::CommitBuild] From c5adb6c4a0507a4b492924f48a25157848699e82 Mon Sep 17 00:00:00 2001 From: Pedro Figueiredo Date: Sun, 16 Sep 2012 22:30:34 +0100 Subject: [PATCH 7/7] Make Test::Synopsis happy --- lib/Net/Amazon/S3.pm | 3 --- lib/Net/Amazon/S3/Bucket.pm | 5 ++++- lib/Net/Amazon/S3/Client.pm | 3 +++ lib/Net/Amazon/S3/Client/Bucket.pm | 3 +++ lib/Net/Amazon/S3/Client/Object.pm | 3 +++ lib/Net/Amazon/S3/HTTPRequest.pm | 3 +++ lib/Net/Amazon/S3/Request/CreateBucket.pm | 3 +++ lib/Net/Amazon/S3/Request/DeleteBucket.pm | 3 +++ lib/Net/Amazon/S3/Request/DeleteObject.pm | 3 +++ lib/Net/Amazon/S3/Request/GetBucketAccessControl.pm | 3 +++ lib/Net/Amazon/S3/Request/GetBucketLocationConstraint.pm | 3 +++ lib/Net/Amazon/S3/Request/GetObject.pm | 3 +++ lib/Net/Amazon/S3/Request/GetObjectAccessControl.pm | 3 +++ lib/Net/Amazon/S3/Request/ListAllMyBuckets.pm | 3 +++ lib/Net/Amazon/S3/Request/ListBucket.pm | 3 +++ lib/Net/Amazon/S3/Request/PutObject.pm | 3 +++ lib/Net/Amazon/S3/Request/SetBucketAccessControl.pm | 3 +++ lib/Net/Amazon/S3/Request/SetObjectAccessControl.pm | 3 +++ 18 files changed, 52 insertions(+), 4 deletions(-) diff --git a/lib/Net/Amazon/S3.pm b/lib/Net/Amazon/S3.pm index 87e4316f..898e1d0a 100644 --- a/lib/Net/Amazon/S3.pm +++ b/lib/Net/Amazon/S3.pm @@ -689,7 +689,6 @@ sub _send_request_expect_nothing { # warn $http_request->as_string; my $response = $self->_do_http($http_request); - my $content = $response->content; return 1 if $response->code =~ /^2\d\d$/; @@ -731,8 +730,6 @@ sub _send_request_expect_nothing_probed { $response = $self->_do_http($http_request); $self->ua->requests_redirectable($old_redirectable); - my $content = $response->content; - return 1 if $response->code =~ /^2\d\d$/; # anything else is a failure, and we save the parsed result diff --git a/lib/Net/Amazon/S3/Bucket.pm b/lib/Net/Amazon/S3/Bucket.pm index bbe176a5..bb387374 100644 --- a/lib/Net/Amazon/S3/Bucket.pm +++ b/lib/Net/Amazon/S3/Bucket.pm @@ -13,6 +13,9 @@ __PACKAGE__->meta->make_immutable; # ABSTRACT: convenience object for working with Amazon S3 buckets +=for test_synopsis +no strict 'vars' + =head1 SYNOPSIS use Net::Amazon::S3; @@ -23,7 +26,7 @@ __PACKAGE__->meta->make_immutable; ok($bucket->add_key("key", "data", { content_type => "text/html", 'x-amz-meta-colour' => 'orange', - }); + })); # the err and errstr methods just proxy up to the Net::Amazon::S3's # objects err/errstr methods. diff --git a/lib/Net/Amazon/S3/Client.pm b/lib/Net/Amazon/S3/Client.pm index 28920d77..fce09dce 100644 --- a/lib/Net/Amazon/S3/Client.pm +++ b/lib/Net/Amazon/S3/Client.pm @@ -127,6 +127,9 @@ sub _send_request_xpc { __END__ +=for test_synopsis +no strict 'vars' + =head1 SYNOPSIS my $s3 = Net::Amazon::S3->new( diff --git a/lib/Net/Amazon/S3/Client/Bucket.pm b/lib/Net/Amazon/S3/Client/Bucket.pm index 9f13a643..87f52276 100644 --- a/lib/Net/Amazon/S3/Client/Bucket.pm +++ b/lib/Net/Amazon/S3/Client/Bucket.pm @@ -145,6 +145,9 @@ sub object { __END__ +=for test_synopsis +no strict 'vars' + =head1 SYNOPSIS # return the bucket name diff --git a/lib/Net/Amazon/S3/Client/Object.pm b/lib/Net/Amazon/S3/Client/Object.pm index a409f608..4c87669e 100644 --- a/lib/Net/Amazon/S3/Client/Object.pm +++ b/lib/Net/Amazon/S3/Client/Object.pm @@ -287,6 +287,9 @@ sub _etag { __END__ +=for test_synopsis +no strict 'vars' + =head1 SYNOPSIS # show the key diff --git a/lib/Net/Amazon/S3/HTTPRequest.pm b/lib/Net/Amazon/S3/HTTPRequest.pm index 078a3277..b5cace4a 100644 --- a/lib/Net/Amazon/S3/HTTPRequest.pm +++ b/lib/Net/Amazon/S3/HTTPRequest.pm @@ -221,6 +221,9 @@ sub _urlencode { __END__ +=for test_synopsis +no strict 'vars' + =head1 SYNOPSIS my $http_request = Net::Amazon::S3::HTTPRequest->new( diff --git a/lib/Net/Amazon/S3/Request/CreateBucket.pm b/lib/Net/Amazon/S3/Request/CreateBucket.pm index 154b5663..236a0ae8 100644 --- a/lib/Net/Amazon/S3/Request/CreateBucket.pm +++ b/lib/Net/Amazon/S3/Request/CreateBucket.pm @@ -42,6 +42,9 @@ sub http_request { __END__ +=for test_synopsis +no strict 'vars' + =head1 SYNOPSIS my $http_request = Net::Amazon::S3::Request::CreateBucket->new( diff --git a/lib/Net/Amazon/S3/Request/DeleteBucket.pm b/lib/Net/Amazon/S3/Request/DeleteBucket.pm index 42249ac9..9da02b59 100644 --- a/lib/Net/Amazon/S3/Request/DeleteBucket.pm +++ b/lib/Net/Amazon/S3/Request/DeleteBucket.pm @@ -22,6 +22,9 @@ sub http_request { __END__ +=for test_synopsis +no strict 'vars' + =head1 SYNOPSIS my $http_request = Net::Amazon::S3::Request::DeleteBucket->new( diff --git a/lib/Net/Amazon/S3/Request/DeleteObject.pm b/lib/Net/Amazon/S3/Request/DeleteObject.pm index f4812bff..dc12d3fb 100644 --- a/lib/Net/Amazon/S3/Request/DeleteObject.pm +++ b/lib/Net/Amazon/S3/Request/DeleteObject.pm @@ -24,6 +24,9 @@ sub http_request { __END__ +=for test_synopsis +no strict 'vars' + =head1 SYNOPSIS my $http_request = Net::Amazon::S3::Request::DeleteObject->new( diff --git a/lib/Net/Amazon/S3/Request/GetBucketAccessControl.pm b/lib/Net/Amazon/S3/Request/GetBucketAccessControl.pm index 4f43408e..ca3fcd44 100644 --- a/lib/Net/Amazon/S3/Request/GetBucketAccessControl.pm +++ b/lib/Net/Amazon/S3/Request/GetBucketAccessControl.pm @@ -23,6 +23,9 @@ sub http_request { __END__ +=for test_synopsis +no strict 'vars' + =head1 SYNOPSIS my $http_request = Net::Amazon::S3::Request::GetBucketAccessControl->new( diff --git a/lib/Net/Amazon/S3/Request/GetBucketLocationConstraint.pm b/lib/Net/Amazon/S3/Request/GetBucketLocationConstraint.pm index 1034386e..410d3be3 100644 --- a/lib/Net/Amazon/S3/Request/GetBucketLocationConstraint.pm +++ b/lib/Net/Amazon/S3/Request/GetBucketLocationConstraint.pm @@ -23,6 +23,9 @@ sub http_request { __END__ +=for test_synopsis +no strict 'vars' + =head1 SYNOPSIS my $http_request = Net::Amazon::S3::Request::GetBucketLocationConstraint->new( diff --git a/lib/Net/Amazon/S3/Request/GetObject.pm b/lib/Net/Amazon/S3/Request/GetObject.pm index 9d82187a..cf8afd98 100644 --- a/lib/Net/Amazon/S3/Request/GetObject.pm +++ b/lib/Net/Amazon/S3/Request/GetObject.pm @@ -35,6 +35,9 @@ sub query_string_authentication_uri { __END__ +=for test_synopsis +no strict 'vars' + =head1 SYNOPSIS my $http_request = Net::Amazon::S3::Request::GetObject->new( diff --git a/lib/Net/Amazon/S3/Request/GetObjectAccessControl.pm b/lib/Net/Amazon/S3/Request/GetObjectAccessControl.pm index 259a482a..e1d30a9c 100644 --- a/lib/Net/Amazon/S3/Request/GetObjectAccessControl.pm +++ b/lib/Net/Amazon/S3/Request/GetObjectAccessControl.pm @@ -24,6 +24,9 @@ sub http_request { __END__ +=for test_synopsis +no strict 'vars' + =head1 SYNOPSIS my $http_request = Net::Amazon::S3::Request::GetObjectAccessControl->new( diff --git a/lib/Net/Amazon/S3/Request/ListAllMyBuckets.pm b/lib/Net/Amazon/S3/Request/ListAllMyBuckets.pm index f5d34798..b7e277e9 100644 --- a/lib/Net/Amazon/S3/Request/ListAllMyBuckets.pm +++ b/lib/Net/Amazon/S3/Request/ListAllMyBuckets.pm @@ -20,6 +20,9 @@ sub http_request { __END__ +=for test_synopsis +no strict 'vars' + =head1 SYNOPSIS my $http_request diff --git a/lib/Net/Amazon/S3/Request/ListBucket.pm b/lib/Net/Amazon/S3/Request/ListBucket.pm index 4e78b381..4c3c4206 100644 --- a/lib/Net/Amazon/S3/Request/ListBucket.pm +++ b/lib/Net/Amazon/S3/Request/ListBucket.pm @@ -48,6 +48,9 @@ sub _urlencode { __END__ +=for test_synopsis +no strict 'vars' + =head1 SYNOPSIS my $http_request = Net::Amazon::S3::Request::ListBucket->new( diff --git a/lib/Net/Amazon/S3/Request/PutObject.pm b/lib/Net/Amazon/S3/Request/PutObject.pm index 6501cb4f..767619f7 100644 --- a/lib/Net/Amazon/S3/Request/PutObject.pm +++ b/lib/Net/Amazon/S3/Request/PutObject.pm @@ -35,6 +35,9 @@ sub http_request { __END__ +=for test_synopsis +no strict 'vars' + =head1 SYNOPSIS my $http_request = Net::Amazon::S3::Request::PutObject->new( diff --git a/lib/Net/Amazon/S3/Request/SetBucketAccessControl.pm b/lib/Net/Amazon/S3/Request/SetBucketAccessControl.pm index e14b5ea5..dddcfa18 100644 --- a/lib/Net/Amazon/S3/Request/SetBucketAccessControl.pm +++ b/lib/Net/Amazon/S3/Request/SetBucketAccessControl.pm @@ -41,6 +41,9 @@ sub http_request { __END__ +=for test_synopsis +no strict 'vars' + =head1 SYNOPSIS my $http_request = Net::Amazon::S3::Request::SetBucketAccessControl->new( diff --git a/lib/Net/Amazon/S3/Request/SetObjectAccessControl.pm b/lib/Net/Amazon/S3/Request/SetObjectAccessControl.pm index 273b22e3..bb45a560 100644 --- a/lib/Net/Amazon/S3/Request/SetObjectAccessControl.pm +++ b/lib/Net/Amazon/S3/Request/SetObjectAccessControl.pm @@ -42,6 +42,9 @@ sub http_request { __END__ +=for test_synopsis +no strict 'vars' + =head1 SYNOPSIS my $http_request = Net::Amazon::S3::Request::SetObjectAccessControl->new(