Gautam Dey > Template-Provider-Amazon-S3-0.006 > Template::Provider::Amazon::S3

Download:
Template-Provider-Amazon-S3-0.006.tar.gz

Dependencies

Annotate this POD

CPAN RT

Open  0
View/Report Bugs
Module Version: 0.006   Source   Latest Release: Template-Provider-Amazon-S3-0.009

NAME ^

Template::Provider::Amazon::S3 - Enable template toolkit to use Amazon's S3 service as a provier of templates.

VERSION ^

version 0.006

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.

last_refresh

  This method will return the DateTime object of the last
  time the internal cache was refreshed.

refresh_cache

  Call this method to refresh the cache.

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.
fetch()
store()
load()
include_path()
paths()
DESTROY()

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. 
refresh_in_seconds
   This is the number of seconds that the cache will expire. The default for this
   is 86400 seconds, which is 1 day. This value can also be set via the environment
   variable TEMPLATE_AWS_REFRESH_IN_SECONDS.
cache_options
   This is the options to provide to the L<CHI> cache module. This can also be set
   by the environment variable TEMPLATE_CACHE_OPTIONS. If using the environment 
   variable, the values need to be L<JSON>  encoded. Otherwise the value will be 
   an in memory store. The option send is the following:

     
     {
         driver => 'RawMemory', 
         global => 1 
     }

Note

  Note do not use the RELATIVE or the ABSOLUTE parameters, I don't know 
  what will happen if they are used. 

SEE ALSO ^

Net::Amazon::S3::Client
Net::Amazon::S3::Client::Bucket
Net::Amazon::S3::Client::Object
CHI

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.

syntax highlighting: