Sample code for 30+ languages & platforms
Perl Requires Chilkat v11.0.0+

Backblaze S3 Delete Bucket Objects

See more Backblaze S3 Examples

Demonstrates how to delete objects in a bucket.

Chilkat Perl Downloads

Perl
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;

# keyID = Access Key ID or Access Key
$http->AwsAccessKey('access-key');

# applicationKey = Secret Access Key or Secret Key
$http->AwsSecretKey('secret-key');

# Region is the 2nd part of your S3 Endpoint
$http->AwsEndpoint('s3.us-west-002.backblazeb2.com');

my $bucketName = 'chilkat-test';

my $objectName1 = 'seahorse.jpg';
my $objectName2 = 'orchard.json';

my $st = Chilkat2::StringTable->new;
$st->Append($objectName1);
$st->Append($objectName2);

my $jsonResp = Chilkat2::JsonObject->new;
my $success = $http->S3_DeleteObjects($bucketName, $st, $jsonResp);
if (!$success) {
    print $http->LastErrorText, "\n";
    exit;
}

print 'Response status code = ', $http->LastStatus, "\n";

# Display the JSON response.
$jsonResp->EmitCompact(0);
print $jsonResp->Emit(), "\n";