Catalyst::Model::S3 - Catalyst model for Amazon's S3 web service


Catalyst-Model-S3 documentation Contained in the Catalyst-Model-S3 distribution.

Index


Code Index:

NAME

Top

Catalyst::Model::S3 - Catalyst model for Amazon's S3 web service

SYNOPSIS

Top

    # Use the helper to add an S3 model to your application...
    script/myapp_create.pl create model S3 S3

    


    # lib/MyApp/Model/S3.pm

    package MyApp::Model::S3;

    use base qw/ Catalyst::Model::S3 /;

    __PACKAGE__->config(
        aws_access_key_id     => 'your_access_key_id',
        aws_secret_access_key => 'your_secret_access_key',
        secure                => 0,  # optional: default 0  (false)
        timeout               => 30, # optional: default 30 (seconds)
    );

    1;

    


    # In a controller...
    my $s3 = $c->model('S3');
    print ref($s3);  # Net::Amazon::S3




DESCRIPTION

Top

This is a Catalyst model class that interfaces with Amazon's Simple Storage Service. See the Net::Amazon::S3 documentation for a description of the methods available. For more on S3 visit: http://aws.amazon.com/s3

METHODS

Top

->new()

Instantiate a new Net::Amazon::S3 Model. See Net::Amazon::S3's new method for the options available.

ACCEPT_CONTEXT

Return the Net::Amazon::S3 object. Called automatically via $c->model('S3');

SEE ALSO

Top

Catalyst, Catalyst::Helper::Model::S3, Net::Amazon::S3

DEPENDENCIES

Top

Carp

Catalyst::Model

Catalyst::Utils

Class::C3

Net::Amazon::Simple

BUGS

Top

Please report any bugs or feature requests to bug-catalyst-model-s3 at rt.cpan.org, or through the web interface at http://rt.cpan.org/NoAuth/ReportBug.html?Queue=Catalyst-Model-S3.

SUPPORT

Top

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

    perldoc Catalyst::Model::S3

You may also look for information at:

* Catalyst::Model::S3

http://perlprogrammer.co.uk/modules/Catalyst::Model::S3/

* AnnoCPAN: Annotated CPAN documentation

http://annocpan.org/dist/Catalyst-Model-S3/

* RT: CPAN's request tracker

http://rt.cpan.org/NoAuth/ReportBug.html?Queue=Catalyst-Model-S3

* Search CPAN

http://search.cpan.org/dist/Catalyst-Model-S3/

AUTHOR

Top

Dave Cardwell <dcardwell@cpan.org>

COPYRIGHT AND LICENSE

Top


Catalyst-Model-S3 documentation Contained in the Catalyst-Model-S3 distribution.
package Catalyst::Model::S3;

use strict;
use warnings;

use base qw/ Catalyst::Model /;

use Carp qw( croak );
use Catalyst::Utils ();
use Class::C3 ();
use Net::Amazon::S3 ();

our $VERSION = '0.03';


sub new {
    my $self  = shift->next::method(@_);
    my $class = ref($self);
    
    my ( $c, $arg_ref ) = @_;
    
    # Ensure that the required configuration is available...
    croak "->config->{aws_access_key_id} must be set for $class\n"
        unless $self->{aws_access_key_id};
    croak "->config->{aws_secret_access_key} must be set for $class\n"
        unless $self->{aws_secret_access_key};
    
    # Instantiate a new S3 object...
    $self->{'.s3'} = Net::Amazon::S3->new(
        Catalyst::Utils::merge_hashes( $arg_ref, $self->config )
    );
    
    return $self;
}


sub ACCEPT_CONTEXT {
    return shift->{'.s3'};
}


1; # End of the module code; everything from here is documentation...
__END__