Catalyst::Helper::Model::S3 - Helper for S3 Catalyst models


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

Index


Code Index:

NAME

Top

Catalyst::Helper::Model::S3 - Helper for S3 Catalyst models

SYNOPSIS

Top

    script/myapp_create.pl model ModelName S3 [ key=your_key secret=your_secret ] [ secure ] [ timeout=30 ]




DESCRIPTION

Top

Use this module to set up a new Catalyst::Model::S3 model for your Catalyst application.

Arguments

    ModelName is the short name for the Model class being generated (eg. "S3")

    key and secret correspond to your Amazon Web Services account's Access Key
    ID and Secret Access Key respectively. For more information see:
    L<http://aws.amazon.com/s3>

    The presence of secure indicates that your Model should use SSL-encrypted
    connections when talking to S3.

    Explicitly setting timeout (in seconds) overrides the default of 30.




METHODS

Top

mk_compclass

This method takes the given arguments and generates a Catalyst::Model::S3 model for your application.

SEE ALSO

Top

Catalyst, Catalyst::Helper, Catalyst::Model::S3

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::Helper::Model::S3

You may also look for information at:

* Catalyst::Model::S3

http://perlprogrammer.co.uk/module/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::Helper::Model::S3;

use strict;
use warnings;

use Carp qw( croak );

our $VERSION = '0.01';


sub mk_compclass {
    my ( $self, $helper, @options ) = @_;
    
    # Extract the arguments...
    foreach (@options) {
        if ( /^key=(.+)$/ ) {
            $helper->{aws_key} = $1;
        }
        elsif ( /^secret=(.+)$/ ) {
            $helper->{aws_secret} = $1;
        }
        elsif ( /^secure$/ ) {
            $helper->{secure} = 1;
        }
        elsif ( /^timeout=(\d+)$/ ) {
            $helper->{timeout} = $1;
        }
    }
    
    $helper->{config_encountered} = (
        exists $helper->{aws_key}
     || exists $helper->{aws_secret}
     || exists $helper->{secure}
     || exists $helper->{timeout}
    );
    
    $helper->render_file( 's3class', $helper->{file} );
}



1;
__DATA__

1;