* [EMAIL PROTECTED] <[EMAIL PROTECTED]> [2002-12-06 14:03]:
> Then do I need the Use Template line in the plugin?
Not in your plugin, though it does no harm.
> What would the [% use %] line look like for my plugin
> MyOrg::Template::Plugin::MyPlugin in a template?
>
> [% use MyOrg::Template::Plugin::MyPlugin %] ?
[% USE MyPlugin %]
The plugin provider (Template::Plugins) looks in each element of
PLUGIN_BASE, and for each one, appends the argument of "USE" from the
template, turns that into a Perl package name, and then tries to load
it. As soon as one works, it stops looking.
So, with PLUGIN_BASE set to:
[ 'MyOrg::Template::Plugin', 'YourOrg::Template::Plugin ']
Template::Plugins will first look for MyOrg::Template::Plugin::MyPlugin.
If MyOrg::Template::Plugin::MyPlugin can be "require"d (well, actually,
MyOrg/Template/Plugin/MyPlugin.pm, relative to @INC), then
Template::Plugins stops looking there (the "USE" was successful). If
not, it moves on to YourOrg::Template::Plugin::MyPlugin, then
Template::Plugin::MyPlugin, and then throw an exception, if they all
fail.
The processing script would look like:
#!perl
use strict;
use Template;
my $t = Template->new({
PLUGIN_BASE => [ 'MyOrg::Template::Plugin',
'YourOrg::Template::Plugin '],
});
and so on. Clearer?
(darren)
--
Faith is a cop-out. It is intellectual bankruptcy. If the only way you
can accept an assertion is by faith, then you are conceding that it
can't be taken on its own merits.
-- Dan Barker
_______________________________________________
templates mailing list
[EMAIL PROTECTED]
http://lists.ourshack.com/mailman/listinfo/templates