Softpedia
 


LINUX CATEGORIES:



GLOBAL PAGES >>
NEWS ARCHIVE >>
SOFTPEDIA REVIEWS >>
MEET THE EDITORS >>
WEEK'S BEST
  • Linux Kernel 3.9.3 / 3....
  • LibreOffice 3.6.6 / 4.0.3
  • MPlayer 1.1.1
  • systemd 204
  • Arch Linux 2013.05.01
  • Blender 2.67a
  • KDE Software Compilatio...
  • CrunchBang Linux Stable...
  • Elementary OS 0.1 / 0.2...
  • SystemRescueCd 3.6.0
  • Home > Linux > Programming > Perl Modules

    AWS::S3 0.031

    Download button

    No screenshots available
    Downloads: 122  Tell us about an update
    User Rating:
    Rated by:
    NOT RATED
    0 user(s)
    Developer:

    License / Price:

    Last Updated:

    Category:
    John Drago | More programs
    Perl Artistic License / FREE
    April 12th, 2012, 19:56 GMT
    ROOT / Programming / Perl Modules

     Read user reviews (0)  Refer to a friend  Subscribe

    AWS::S3 description

    Lightweight interface to Amazon S3 (Simple Storage Service)

    AWS::S3 is a Perl module that attempts to provide an alternate interface to the Amazon S3 Simple Storage Service.

    SYNOPSIS

     use AWS::S3;
     
     my $s3 = AWS::S3->new(
     access_key_id => 'E654SAKIASDD64ERAF0O',
     secret_access_key => 'LgTZ25nCD+9LiCV6ujofudY1D6e2vfK0R4GLsI4H',
     );
     
     # Add a bucket:
     my $bucket = $s3->add_bucket(
     name => 'foo-bucket',
     );
     
     # Set the acl:
     $bucket->acl( 'private' );
     
     # Add a file:
     my $new_file = $bucket->add_file(
     key => 'foo/bar.txt',
     contents => \'This is the contents of the file',
     );
     
     # You can also set the contents with a coderef:
     # Coderef should eturn a reference, not the actual string of content:
     $new_file = $bucket->add_file(
     key => 'foo/bar.txt',
     contents => sub { return \"This is the contents" }
     );
     
     # Get the file:
     my $same_file = $bucket->file( 'foo/bar.txt' );
     
     # Get the contents:
     my $scalar_ref = $same_file->contents;
     print $$scalar_ref;
     
     # Update the contents with a scalar ref:
     $same_file->contents( \"New file contents" );
     
     # Update the contents with a code ref:
     $same_file->contents( sub { return \"New file contents" } );
     
     # Delete the file:
     $same_file->delete();
     
     # Iterate through lots of files:
     my $iterator = $bucket->files(
     page_size => 100,
     page_number => 1,
     );
     while( my @files = $iterator->next_page )
     {
     warn "Page number: ", $iterator->page_number, "\n";
     foreach my $file ( @files )
     {
     warn "\tFilename (key): ", $file->key, "\n";
     warn "\tSize: ", $file->size, "\n";
     warn "\tETag: ", $file->etag, "\n";
     warn "\tContents: ", ${ $file->contents }, "\n";
     }# end foreach()
     }# end while()
     
     # You can't delete a bucket until it's empty.
     # Empty a bucket like this:
     while( my @files = $iterator->next_page )
     {
     map { $_->delete } @files;
     
     # Return to page 1:
     $iterator->page_number( 1 );
     }# end while()
     
     # Now you can delete the bucket:
     $bucket->delete();


    Product's homepage

    Requirements:

    · Perl

      


    TAGS:

    Amazon S3 | Perl interface | Perl | Amazon | S3

    Go to top

    WindowsGamesDriversMacLinuxScriptsMobileHandheldNews

    SUBMIT PROGRAM   |   ADVERTISE   |   GET HELP   |   SEND US FEEDBACK   |   RSS FEEDS   |   UPDATE YOUR SOFTWARE   |   ROMANIAN FORUM