NAME

Amazon::S3Curl::PurePerl - Pure Perl s3 helper/downloader.

VERSION

version 0.054

DESCRIPTION

This software is designed to run in low dependency situations. You need curl, and you need perl ( If you are on linux, you probably have perl whether you know it or not ).

Maybe you're bootstrapping a system from s3, or downloading software to a host where you can't/don't want to install anything.

SYNOPSIS

    my $s3curl = Amazon::S3Curl::PurePerl->new({
            aws_access_key => $ENV{AWS_ACCESS_KEY},
            aws_secret_key => $ENV{AWS_SECRET_KEY},
            local_file     => "/tmp/myapp.tgz",
            url            => "/mybootstrap-files/myapp.tgz"
    });
    $s3curl->download;

Using Object::Remote:

    use Object::Remote;
    my $conn = Object::Remote->connect("webserver-3");

    my $s3_downloader = Amazon::S3Curl::PurePerl->new::on(
        $conn,
        {
            aws_access_key => $ENV{AWS_ACCESS_KEY},
            aws_secret_key => $ENV{AWS_SECRET_KEY},
            local_file     => "/tmp/myapp.tgz",
            url            => "/mybootstrap-files/myapp.tgz"
        } );

    $s3_downloader->download;

PARAMETERS

aws_access_key ( required )
aws_secret_key ( required )
url ( required )

This is the (url to download|upload to|delete). It should be a relative path with the bucket name, and whatever pseudopaths you want.

For upload: Left with a trailing slash, it'll DWYM, curl style.

local_file

This is the (path to download to|file to upload).

METHODS

new

Constructor, provided by Moo.

download

    $s3curl->download;

download url to local_file.

upload

    $s3curl->upload;

Upload local_file to url.

delete

    $s3curl->delete;

Delete url.

delete_cmd

download_cmd

upload_cmd

Just get the command to execute in the form of an arrayref, don't actually execute it:

    my $cmd = $s3curl->download_cmd;
    system(@$cmd);

url_exists

Check to see if a given url returns a 404 or 200. return 1 if 200, return 0 if 404, die otherwise.

LICENSE

This library is free software and may be distributed under the same terms as perl itself.

AUTHOR AND CONTRIBUTORS

This distribution was adapted by Samuel Kaufman skaufman@cpan.org from the Amazon S3 Authentication Tool for Curl

   Amazon S3 Authentication Tool for Curl
   Copyright 2006-2010 Amazon.com, Inc. or its affiliates. All Rights Reserved.