NAME
Template::Provider::Amazon::S3 - Enable template toolkit to use Amazon's S3 service as a provier of templates.
VERSION
version 0.003
SYNOPSIS
use Template;
use Template::Provider::Amazon::S3;
# Specify the provider in the config for Template::Toolkit.
# Note since the AWS ACCESS KEY, SECRET, and bucket name
# is not provided here, it will get it from the following
# Envrionmental variables:
# AWS_ACCESS_KEY_ID
# AWS_SECRET_ACCESS_KEY
# AWS_TEMPLATE_BUCKET
my $tt_config = {
LOAD_TEMPLATES => [
Template::Provider::Amazon::S3->new( INCLUDE_PATH => [ 'dir1', 'dir2' ] )
]
};
my $tt = Template->new($tt_config);
$tt->process('file_on_s3',$vars) || die $tt->error;
METHODS
client
This method will return the S3 client.
bucket
This method will return the bucket that was configure in the begining.
object
returns the object for a given key.
This method take a key parameter.
$obj = $self->object( key => 'some_path' );
INHERITED METHODS
These methods are inherited from Template::Provider and function in the same way.
CLASS Methods
$obj = $class->new( %parameters )
constructs a new instance.
Accepts all the arguments as the base class L<Template::Provider>, with the following additions:
- key
-
This is the Amazon Access key, if this is not provided we will try and load this from the AWS_ACCESS_KEY_ID environment variable.
- secret
-
This is the Amazon Secret Key, if this is not provided we will try and load this from the AWS_ACCESS_KEY_SECRET environment variable.
- bucketname
-
This is the bucket that will contain all the templates. If this it not provided we will try and get it from the AWS_TEMPLATE_BUCKET envrionement variable.
- INCLUDE_PATH
-
This should be an array ref to directories that will be searched for the template. This method is really naive, and just prepends each entry to the template name.
Note
Note do not use the RELATIVE or the ABSOLUTE parameters, I don't know
what will happen if they are used.
SEE ALSO
AUTHOR
Gautam Dey <gdey@cpan.org>
COPYRIGHT AND LICENSE
This software is copyright (c) 2012 by Gautam Dey <gdey@cpan.org>.
This is free software; you can redistribute it and/or modify it under the same terms as the Perl 5 programming language system itself.