[Templates-cvs] cvs commit: Template2/docsrc/lib/option plugins

cvs@template-toolkit.org cvs@template-toolkit.org


cvs         06/01/30 10:34:40

  Modified:    docsrc/lib/option plugins
  Log:
  * added note on lower case plugin names
  
  Revision  Changes    Path
  1.2       +20 -8     Template2/docsrc/lib/option/plugins
  
  Index: plugins
  ===================================================================
  RCS file: /template-toolkit/Template2/docsrc/lib/option/plugins,v
  retrieving revision 1.1
  retrieving revision 1.2
  diff -u -r1.1 -r1.2
  --- plugins	2001/03/27 11:15:01	1.1
  +++ plugins	2006/01/30 10:34:40	1.2
  @@ -13,13 +13,25 @@
   redefined by values in the PLUGINS hash.
   
       my [* obj *] = [* pkg *]->new({
  -	PLUGINS => {
  -	    cgi => 'MyOrg::Template::Plugin::CGI',
  -    	    foo => 'MyOrg::Template::Plugin::Foo',
  -	    bar => 'MyOrg::Template::Plugin::Bar',
  -	},
  -    });
  +        PLUGINS => {
  +            cgi => 'MyOrg::Template::Plugin::CGI',
  +            foo => 'MyOrg::Template::Plugin::Foo',
  +            bar => 'MyOrg::Template::Plugin::Bar',
  +        },  
  +    }); 
   
  +The recommended convention is to specify these plugin names in lower
  +case.  The Template Toolkit first looks for an exact case-sensitive
  +match and then tries the lower case conversion of the name specified.
  +
  +    [% USE Foo %]      # look for 'Foo' then 'foo'
  +
  +If you define all your PLUGINS with lower case names then they will be
  +located regardless of how the user specifies the name in the USE
  +directive.  If, on the other hand, you define your PLUGINS with upper
  +or mixed case names then the name specified in the USE directive must
  +match the case exactly.  
  +
   The USE directive is used to create plugin objects and does so by
   calling the plugin() method on the current Template::Context object.
   If the plugin name is defined in the PLUGINS hash then the
  @@ -28,6 +40,6 @@
   (default and general case) or a prototype object against which the 
   new() method can be called to instantiate individual plugin objects.
   
  -If the plugin name is not defined in the PLUGINS hash then the PLUGIN_BASE
  -and/or LOAD_PERL options come into effect.
  +If the plugin name is not defined in the PLUGINS hash then the
  +PLUGIN_BASE and/or LOAD_PERL options come into effect.