r29783 - in /trunk/libnet-amazon-s3-perl: CHANGES META.yml debian/changelog lib/Net/Amazon/S3.pm lib/Net/Amazon/S3/Client/Bucket.pm t/02client.t
gregoa at users.alioth.debian.org
gregoa at users.alioth.debian.org
Sat Jan 17 22:15:28 UTC 2009
Author: gregoa
Date: Sat Jan 17 22:15:24 2009
New Revision: 29783
URL: http://svn.debian.org/wsvn/pkg-perl/?sc=1&rev=29783
Log:
new upstream release, still missing: Data::Stream::Bulk::Callback
Modified:
trunk/libnet-amazon-s3-perl/CHANGES
trunk/libnet-amazon-s3-perl/META.yml
trunk/libnet-amazon-s3-perl/debian/changelog
trunk/libnet-amazon-s3-perl/lib/Net/Amazon/S3.pm
trunk/libnet-amazon-s3-perl/lib/Net/Amazon/S3/Client/Bucket.pm
trunk/libnet-amazon-s3-perl/t/02client.t
Modified: trunk/libnet-amazon-s3-perl/CHANGES
URL: http://svn.debian.org/wsvn/pkg-perl/trunk/libnet-amazon-s3-perl/CHANGES?rev=29783&op=diff
==============================================================================
--- trunk/libnet-amazon-s3-perl/CHANGES (original)
+++ trunk/libnet-amazon-s3-perl/CHANGES Sat Jan 17 22:15:24 2009
@@ -1,4 +1,8 @@
Revision history for Perl module Net::Amazon::S3:
+
+0.49 Tue Jan 13 09:04:42 GMT 2009
+ - add support for listing a bucket with a prefix to
+ Net::Amazon::S3::Client::Bucket
0.48 Thu Dec 4 09:24:23 GMT 2008
- be slightly less strict about bucket names: they can contain uppercase
Modified: trunk/libnet-amazon-s3-perl/META.yml
URL: http://svn.debian.org/wsvn/pkg-perl/trunk/libnet-amazon-s3-perl/META.yml?rev=29783&op=diff
==============================================================================
--- trunk/libnet-amazon-s3-perl/META.yml (original)
+++ trunk/libnet-amazon-s3-perl/META.yml Sat Jan 17 22:15:24 2009
@@ -1,6 +1,6 @@
--- #YAML:1.0
name: Net-Amazon-S3
-version: 0.48
+version: 0.49
abstract: Use the Amazon S3 - Simple Storage Service
license: perl
author:
Modified: trunk/libnet-amazon-s3-perl/debian/changelog
URL: http://svn.debian.org/wsvn/pkg-perl/trunk/libnet-amazon-s3-perl/debian/changelog?rev=29783&op=diff
==============================================================================
--- trunk/libnet-amazon-s3-perl/debian/changelog (original)
+++ trunk/libnet-amazon-s3-perl/debian/changelog Sat Jan 17 22:15:24 2009
@@ -1,4 +1,4 @@
-libnet-amazon-s3-perl (0.48-1) UNRELEASED; urgency=low
+libnet-amazon-s3-perl (0.49-1) UNRELEASED; urgency=low
NEEDS Data::Stream::Bulk::Callback
Modified: trunk/libnet-amazon-s3-perl/lib/Net/Amazon/S3.pm
URL: http://svn.debian.org/wsvn/pkg-perl/trunk/libnet-amazon-s3-perl/lib/Net/Amazon/S3.pm?rev=29783&op=diff
==============================================================================
--- trunk/libnet-amazon-s3-perl/lib/Net/Amazon/S3.pm (original)
+++ trunk/libnet-amazon-s3-perl/lib/Net/Amazon/S3.pm Sat Jan 17 22:15:24 2009
@@ -140,7 +140,7 @@
has 'err' => ( is => 'rw', isa => 'Maybe[Str]', required => 0 );
has 'errstr' => ( is => 'rw', isa => 'Maybe[Str]', required => 0 );
-our $VERSION = '0.48';
+our $VERSION = '0.49';
my $KEEP_ALIVE_CACHESIZE = 10;
Modified: trunk/libnet-amazon-s3-perl/lib/Net/Amazon/S3/Client/Bucket.pm
URL: http://svn.debian.org/wsvn/pkg-perl/trunk/libnet-amazon-s3-perl/lib/Net/Amazon/S3/Client/Bucket.pm?rev=29783&op=diff
==============================================================================
--- trunk/libnet-amazon-s3-perl/lib/Net/Amazon/S3/Client/Bucket.pm (original)
+++ trunk/libnet-amazon-s3-perl/lib/Net/Amazon/S3/Client/Bucket.pm Sat Jan 17 22:15:24 2009
@@ -64,7 +64,9 @@
}
sub list {
- my $self = shift;
+ my ( $self, $conf ) = @_;
+ $conf ||= {};
+ my $prefix = $conf->{prefix};
my $marker = undef;
my $end = 0;
@@ -78,6 +80,7 @@
s3 => $self->client->s3,
bucket => $self->name,
marker => $marker,
+ prefix => $prefix,
)->http_request;
my $xpc = $self->client->_send_request_xpc($http_request);
@@ -163,6 +166,9 @@
}
}
+ # or list by a prefix
+ my $prefix_stream = $bucket->list( { prefix => 'logs/' } );
+
# returns a L<Net::Amazon::S3::Client::Object>, which can then
# be used to get or put
my $object = $bucket->object( key => 'this is the key' );
@@ -199,6 +205,9 @@
}
}
+ # or list by a prefix
+ my $prefix_stream = $bucket->list( { prefix => 'logs/' } );
+
=head2 location_constraint
# return the bucket location constraint
Modified: trunk/libnet-amazon-s3-perl/t/02client.t
URL: http://svn.debian.org/wsvn/pkg-perl/trunk/libnet-amazon-s3-perl/t/02client.t?rev=29783&op=diff
==============================================================================
--- trunk/libnet-amazon-s3-perl/t/02client.t (original)
+++ trunk/libnet-amazon-s3-perl/t/02client.t Sat Jan 17 22:15:24 2009
@@ -11,7 +11,7 @@
unless ( $ENV{'AMAZON_S3_EXPENSIVE_TESTS'} ) {
plan skip_all => 'Testing this module for real costs money.';
} else {
- plan tests => 31;
+ plan tests => 33;
}
use_ok('Net::Amazon::S3');
@@ -80,14 +80,33 @@
$object->put('this is the value');
my @objects;
-$stream = $bucket->list;
-until ( $stream->is_done ) {
- foreach my $object ( $stream->items ) {
- push @objects, $object;
- }
-}
-
-is( @objects, 1, 'have newly created key' );
+
+ at objects = ();
+$stream = $bucket->list( { prefix => 'this is the key' } );
+until ( $stream->is_done ) {
+ foreach my $object ( $stream->items ) {
+ push @objects, $object;
+ }
+}
+is( @objects, 1, 'bucket list with prefix finds key' );
+
+ at objects = ();
+$stream = $bucket->list( { prefix => 'this is not the key' } );
+until ( $stream->is_done ) {
+ foreach my $object ( $stream->items ) {
+ push @objects, $object;
+ }
+}
+is( @objects, 0, 'bucket list with different prefix does not find key' );
+
+ at objects = ();
+$stream = $bucket->list;
+until ( $stream->is_done ) {
+ foreach my $object ( $stream->items ) {
+ push @objects, $object;
+ }
+}
+is( @objects, 1, 'bucket list finds newly created key' );
is( $objects[0]->key,
'this is the key',
More information about the Pkg-perl-cvs-commits
mailing list