Tom Wyant > Astro-App-Satpass2-0.012_01 > Astro::App::Satpass2::Format::Template::Provider



Annotate this POD

View/Report Bugs
Module Version: 0.012_01   Source   Latest Release: Astro-App-Satpass2-0.017


Astro::App::Satpass2::Format::Template::Provider - Template provider.


 No user serviceable parts inside.


This class is private to the Astro::App::Satpass2 package. The interface may change, or the whole package be revoked, without notice. The following documentation is for the benefit of the author.

This class is a subclass of Template::Provider, designed to provide template storage for Astro::App::Satpass2::Format::Template and double as a template source for Template-Toolkit.

Caveat: The Template::Provider documentation says that subclasses should provide a modification time of the template, to drive the cache mechanism. This subclass does not actually provide a time, but instead provides a positive integer that is incremented each time the template is changed. This prevents problems if a template is changed twice in the same second, but may have other consequences.


This class supports no public methods. It does support the following methods which are private to Astro::App::Satpass2:


 my ( $data, $status ) = $obj->load( $name );

This is really an override of the Template::Provider method of the same name. But though it is named like a public method, this method is not documented there, so it is documented here to keep Test::Pod::Coverage from complaining.

According to the in-code comments, it loads a template but does not compile it, and returns (if successful) the template source.


 foreach ( sort $obj->__satpass2_defined_templates() ) {

This method returns an unordered list of the names of all defined templates.


 $obj->__satpass2_template( foo => 'bar' );
 my ( $tplt, $mtime ) = $obj->__stapass2_template( 'foo' );
 print "Template foo: $tplt, modified ", scalar localtime $mtime;

If called with a single argument, this method returns the named template. In list context it returns not only the template but its modification time. If the template does not exist, it simply returns, yielding undef in scalar context, and an empty list in list context.

If called with two arguments, this method sets the named template to the given text, recording its modification time as the current time.

There is no mechanism to delete a template once defined, because I know of no mechanism to delete it from the Template-Toolkit cache.






Thomas R. Wyant, III wyant at cpan dot org


Copyright (C) 2011-2013 by Thomas R. Wyant, III



syntax highlighting: