[Templates-cvs] cvs commit: Template2/docsrc/lib/option plugbase
cvs@template-toolkit.org
cvs@template-toolkit.org
cvs 06/01/30 10:32:54
Modified: docsrc/lib/option plugbase
Log:
* added detail on clearing $Template::Plugins::PLUGIN_BASE if you
don't want Template::Plugin added to your PLUGIN_BASE
Revision Changes Path
1.2 +27 -9 Template2/docsrc/lib/option/plugbase
Index: plugbase
===================================================================
RCS file: /template-toolkit/Template2/docsrc/lib/option/plugbase,v
retrieving revision 1.1
retrieving revision 1.2
diff -u -r1.1 -r1.2
--- plugbase 2001/03/27 11:15:01 1.1
+++ plugbase 2006/01/30 10:32:54 1.2
@@ -10,17 +10,15 @@
to attempt to construct a correct Perl module name which can be successfully
loaded.
-The PLUGIN_BASE can be specified as a single value or as a reference
-to an array of multiple values. The default PLUGIN_BASE value,
-'Template::Plugin', is always added the the end of the PLUGIN_BASE
-list (a single value is first converted to a list). Each value should
-contain a Perl package name to which the requested plugin name is
-appended.
+The PLUGIN_BASE can be specified as a reference to an array of module
+namespaces, or as a single value which is automatically converted to a
+list. The default PLUGIN_BASE value ('Template::Plugin') is then added
+to the end of this list.
example 1:
my [* obj *] = [* pkg *]->new({
- PLUGIN_BASE => 'MyOrg::Template::Plugin',
+ PLUGIN_BASE => 'MyOrg::Template::Plugin',
});
[% USE Foo %] # => MyOrg::Template::Plugin::Foo
@@ -29,11 +27,31 @@
example 2:
my [* obj *] = [* pkg *]->new({
- PLUGIN_BASE => [ 'MyOrg::Template::Plugin',
- 'YourOrg::Template::Plugin' ],
+ PLUGIN_BASE => [ 'MyOrg::Template::Plugin',
+ 'YourOrg::Template::Plugin' ],
});
[% USE Foo %] # => MyOrg::Template::Plugin::Foo
or YourOrg::Template::Plugin::Foo
or Template::Plugin::Foo
+
+If you don't want the default Template::Plugin namespace added to the
+end of the PLUGIN_BASE, then set the $Template::Plugins::PLUGIN_BASE
+variable to a false value before calling the [* pkg *] new()
+constructor method. This is shown in the example below where the
+'Foo' is located as 'My::Plugin::Foo' or 'Your::Plugin::Foo' but not
+as 'Template::Plugin::Foo'.
+
+example 3:
+
+ use Template::Plugins;
+ $Template::Plugins::PLUGIN_BASE = '';
+
+ my [* obj *] = [* pkg *]->new({
+ PLUGIN_BASE => [ 'My::Plugin',
+ 'Your::Plugin' ],
+ });
+
+ [% USE Foo %] # => My::Plugin::Foo
+ or Your::Plugin::Foo