NAME

SOAP::Amazon::S3 - A module for interfacing with Amazon S3 through SOAP

VERSION

Version 0.0401

SYNOPSIS

An object-oriented interface to handle your Amazon S3 storage. (Still experimental, although functional)

use SOAP::Amazon::S3;

my $s3 = SOAP::Amazon::S3->new( $access_key_id, $secret_access_key, { Debug => 1, RaiseError => 1 } );

my @buckets = $s3->listbuckets;
my $bucket = $s3->createbucket('mybucketname');
my $bucket = $s3->bucket('myoldbucket'); # won't create a new bucket

print $bucket->name;
$bucket->delete;

my @objects = $bucket->list;
my $object = $bucket->putobject( $obj_key, $obj_data, { 'Content-Type' => 'text/plain' } );
my $object = $bucket->object( $old_obj_key ); # won't put a new object in the bucket

print $object->name;
$object->delete;
$object->acl('public');
$object->acl('private');
print $object->acl(); # will print 'public' or 'private'

$data = $object->getdata;

FUNCTIONS

SOAP::Amazon::S3->new( $access_key_id, $secret_key_id, { Debug => 0_or_1, RaiseError => 0_or_1 } );

Creates a new S3 requester object. The {} parameters are optional and default to 0. Debug will output all SOAP communications on screen. RaiseError will make your program die if it receives an error reply from Amazon S3, and output the error message on screen. If RaiseError is off, then $s3->{'error'} will still be set to true when an S3 error occurs.

OBJECT METHODS

$s3->listbuckets

Returns the list of buckets in SOAP::Amazon::S3::Bucket form

$s3->createbucket( $bucket_name )

Creates a bucket named $bucket_name in your S3 space and returns the appropriate ...::S3::Bucket type object for further use

$s3->bucket( $bucket_name )

Returns an ...::S3::Bucket type object, corresponding to an already existing bucket in your S3 space, named $bucket_name

$bucket->delete

Deletes the bucket if empty. If not empty, Amazon S3 returns an error (viewable in $s3->{'error'})

$bucket->list

Returns the list of objects in the bucket, in the form of ..::S3::Object type objects

$bucket->name

Returns the name of the bucket

$bucket->putobject( $obj_key, $obj_data, { 'Content-Type' => $mime_type, metadata => {color=>'red', feel=>'soft'} } )

Creates an object in the S3 bucket, named $obj_key. The {} section is optional, and may contain the Content-Type (defaults to 'text/plain') and a metadata hashref. Returns an ...::S3::Object type object pointing to the object just created, if successful.

$bucket->object( $old_obj_key )

Returns an ...::S3::Object type object, corresponding to an already created object in the S3 bucket, named $old_obj_key

$object->name

Returns the Key attribute of an object

$object->delete

Deletes the object

$object->acl( 'public' or 'private' or nothing )

Gets or sets the object's ACL, making it public (and viewable through the web) or private just to you. If no parameter is entered, returns either 'public' or 'private'.

$object->getdata

Returns the data of the object, after fetching it from S3

$object->url

Return the URL of the object

AUTHOR

Alexander Karelas, <karjala at karjala.org>

BUGS

Please report any bugs or feature requests to bug-soap-amazon-s3 at rt.cpan.org, or through the web interface at http://rt.cpan.org/NoAuth/ReportBug.html?Queue=SOAP-Amazon-S3. I will be notified, and then you'll automatically be notified of progress on your bug as I make changes.

SUPPORT

You can find documentation for this module with the perldoc command.

perldoc SOAP::Amazon::S3

You can also look for information at:

ACKNOWLEDGEMENTS

COPYRIGHT & LICENSE

Copyright 2006-2007 Alexander Karelas, all rights reserved.

This program is free software; you can redistribute it and/or modify it under the same terms as Perl itself.