Perl Requires Chilkat v11.0.0+
Chilkat2 Perl
S3 Delete Multiple Objects
See more Amazon S3 Examples
Demonstrates how to delete multiple objects in a single HTTP request.Chilkat Perl Downloads
use strict;
use warnings;
use Chilkat2;
# This example requires the Chilkat API to have been previously unlocked.
# See Global Unlock Sample for sample code.
my $http = Chilkat2::Http->new;
# Insert your access key here:
$http->AwsAccessKey('ABQXXABC83ABCDEFVQXX');
# Insert your secret key here:
$http->AwsSecretKey('XXXXYYYYabcdABCD12345678xxxxyyyyzzzz');
my $bucketName = 'chilkattestbucket';
my $objectName1 = 'starfish.jpg';
# Delete a particular version of this object:
my $objectName2 = 'conch.jpg; VersionId="3/L4kqtJlcpXroDTDmJ+rmSpXd3dIbrHY+MTRCxf3vjVBH40Nr8X8gdRQBpUMLUo"';
my $objectName3 = 'seaUrchin.jpg';
my $st = Chilkat2::StringTable->new;
$st->Append($objectName1);
$st->Append($objectName2);
$st->Append($objectName3);
my $jsonResp = Chilkat2::JsonObject->new;
my $success = $http->S3_DeleteObjects($bucketName, $st, $jsonResp);
if (!$success) {
print $http->LastErrorText, "\n";
exit;
}
# Display the JSON response.
$jsonResp->EmitCompact(0);
print $jsonResp->Emit(), "\n";