AnyEvent-Net-Amazon-S3
view release on metacpan or search on metacpan
t/02client.t view on Meta::CPAN
is( ( head( $object->uri ) )[0],
'text/plain', 'newly created public object has the right content type' );
is( ( head( $object->uri ) )[3],
$object->expires->epoch,
'newly created public object has the right expires' );
$object->delete;
# delete a non-existant object
$object = $bucket->object( key => 'not here' );
throws_ok { $object->get } qr/NoSuchKey/,
'getting non-existant object throws exception';
# upload a file with put_filename
$object = $bucket->object( key => 'the readme' );
$object->put_filename('README');
@objects = ();
$stream = $bucket->list;
until ( $stream->is_done ) {
foreach my $object ( $stream->items ) {
t/02client.t view on Meta::CPAN
$object->get_filename($tmp_fh->filename);
is( stat($tmp_fh->filename)->size, 6 * 1024 * 1024, "downloaded file has a size equivalent to the sum of it's parts");
$tmp_fh->seek((5 * 1024 * 1024) - 1, SEEK_SET);#jump to 5MB position
my $test_bytes;
read($tmp_fh, $test_bytes, 2);
is($test_bytes, "xz", "The second chunk of the file begins in the correct place");
#test listing a multipart object
$stream = $bucket->list({prefix => 'new multipart file'});
lives_ok {my @items = $stream->items} 'Listing a multipart file does not throw an exeption';
$object->delete;
#test multi-object delete
#make 3 identical objects
@objects =();
for my $i(1..3){
my $bulk_object = $bucket->object(
key => "bulk-readme-$i",
etag => $readme_md5hex,
( run in 0.541 second using v1.01-cache-2.11-cpan-496ff517765 )