NAME

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

SYNOPSIS

No user serviceable parts inside.

DESCRIPTION

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.

METHODS

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

load

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.

__satpass2_defined_templates

foreach ( sort $obj->__satpass2_defined_templates() ) {
    say;
}

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

__satpass2_template

$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.

SEE ALSO

Template::Provider.

SUPPORT

Support is by the author. Please file bug reports at http://rt.cpan.org, or in electronic mail to the author.

AUTHOR

Thomas R. Wyant, III wyant at cpan dot org

COPYRIGHT AND LICENSE

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

This program is free software; you can redistribute it and/or modify it under the same terms as Perl 5.10.0. For more details, see the full text of the licenses in the directory LICENSES.

This program is distributed in the hope that it will be useful, but without any warranty; without even the implied warranty of merchantability or fitness for a particular purpose.