446 lines
		
	
	
		
			10 KiB
		
	
	
	
		
			HTML
		
	
	
	
	
	
			
		
		
	
	
			446 lines
		
	
	
		
			10 KiB
		
	
	
	
		
			HTML
		
	
	
	
	
	
<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Strict//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-strict.dtd">
 | 
						|
<html xmlns="http://www.w3.org/1999/xhtml">
 | 
						|
<head>
 | 
						|
<title>GT::Template::Inheritance - Provides GT::Template inheritance/local file
 | 
						|
determination.</title>
 | 
						|
<link rev="made" href="mailto:root@penguin.office.gossamer-threads.com" />
 | 
						|
 | 
						|
<style type="text/css">
 | 
						|
/* $MVD$:fontset("Untitled Font Set 1","ARIEL","HELVETICA","HELV","SANSERIF") */
 | 
						|
/* $MVD$:fontset("Arial","Arial") */
 | 
						|
/* $MVD$:fontset("Arial Black","Arial Black") */
 | 
						|
/* $MVD$:fontset("Algerian","Algerian") */
 | 
						|
 | 
						|
 | 
						|
body {
 | 
						|
    background-color: white;
 | 
						|
    font-family: Verdana, Arial, sans-serif;
 | 
						|
    font-size: small;
 | 
						|
    color: black;
 | 
						|
}
 | 
						|
 | 
						|
 | 
						|
p {
 | 
						|
    background-color : white;
 | 
						|
    font-family : Verdana, Arial, sans-serif;
 | 
						|
    font-size : small;
 | 
						|
    color : black;
 | 
						|
}
 | 
						|
 | 
						|
 | 
						|
h1 {
 | 
						|
    font-family : Verdana, Arial, sans-serif;
 | 
						|
    font-weight : bold;
 | 
						|
    font-size : medium;
 | 
						|
    background-color : white;
 | 
						|
    color : maroon;
 | 
						|
}
 | 
						|
 | 
						|
 | 
						|
h2 {
 | 
						|
    font-family : Verdana, Arial, sans-serif;
 | 
						|
    font-size : medium;
 | 
						|
    font-weight : bold;
 | 
						|
    color : blue;
 | 
						|
    background-color : white;
 | 
						|
}
 | 
						|
 | 
						|
 | 
						|
h3 {
 | 
						|
    font-family : Verdana, Arial, sans-serif;
 | 
						|
    font-weight : bold;
 | 
						|
    font-size : medium;
 | 
						|
    color : black;
 | 
						|
    background-color : white;
 | 
						|
}
 | 
						|
 | 
						|
 | 
						|
h4 {
 | 
						|
    font-family : Verdana, Arial, sans-serif;
 | 
						|
    font-weight : bold;
 | 
						|
    font-size : small;
 | 
						|
    color : maroon;
 | 
						|
    background-color : white;
 | 
						|
}
 | 
						|
 | 
						|
 | 
						|
h5 {
 | 
						|
    font-family : Verdana, Arial, sans-serif;
 | 
						|
    font-weight : bold;
 | 
						|
    font-size : small;
 | 
						|
    color : blue;
 | 
						|
    background-color : white;
 | 
						|
}
 | 
						|
 | 
						|
 | 
						|
h6 {
 | 
						|
    font-family : Verdana, Arial, sans-serif;
 | 
						|
    font-weight : bold;
 | 
						|
    font-size : small;
 | 
						|
    color : black;
 | 
						|
    background-color : white;
 | 
						|
}
 | 
						|
 | 
						|
 | 
						|
ul {
 | 
						|
    font-family : Verdana, Arial, sans-serif;
 | 
						|
    font-size : small;
 | 
						|
    color : black;
 | 
						|
}
 | 
						|
 | 
						|
 | 
						|
ol {
 | 
						|
    font-family : Verdana, Arial, sans-serif;
 | 
						|
    font-size : small;
 | 
						|
    color : black;
 | 
						|
}
 | 
						|
 | 
						|
 | 
						|
dl {
 | 
						|
    font-family : Verdana, Arial, sans-serif;
 | 
						|
    font-size : small;
 | 
						|
    color : black;
 | 
						|
}
 | 
						|
 | 
						|
 | 
						|
li {
 | 
						|
    font-family : Verdana, Arial, sans-serif;
 | 
						|
    font-size : small;
 | 
						|
    color : black;
 | 
						|
}
 | 
						|
 | 
						|
 | 
						|
th {
 | 
						|
    font-family : Verdana, Arial, sans-serif;
 | 
						|
    font-size : small;
 | 
						|
    color : black;
 | 
						|
}
 | 
						|
 | 
						|
 | 
						|
td {
 | 
						|
    font-family : Verdana, Arial, sans-serif;
 | 
						|
    font-size : small;
 | 
						|
    color : black;
 | 
						|
}
 | 
						|
 | 
						|
 | 
						|
dl {
 | 
						|
    font-family : Verdana, Arial, sans-serif;
 | 
						|
    font-size : small;
 | 
						|
    color : black;
 | 
						|
}
 | 
						|
 | 
						|
 | 
						|
dd {
 | 
						|
    font-family : Verdana, Arial, sans-serif;
 | 
						|
    font-size : small;
 | 
						|
    color : black;
 | 
						|
}
 | 
						|
 | 
						|
 | 
						|
dt {
 | 
						|
    font-family : Verdana, Arial, sans-serif;
 | 
						|
    font-size : small;
 | 
						|
    color : black;
 | 
						|
}
 | 
						|
 | 
						|
 | 
						|
code {
 | 
						|
    font-family : Courier;
 | 
						|
    font-size : small;
 | 
						|
    color : black;
 | 
						|
}
 | 
						|
 | 
						|
 | 
						|
pre {
 | 
						|
    font-family : Courier;
 | 
						|
    font-size : small;
 | 
						|
    color : black;
 | 
						|
}
 | 
						|
 | 
						|
.mvd-H1 {
 | 
						|
    font-family : Verdana, Arial, sans-serif;
 | 
						|
    font-weight : bold;
 | 
						|
    font-size : 14.0pt;
 | 
						|
    background-color : transparent;
 | 
						|
    background-image : none;
 | 
						|
    color : maroon;
 | 
						|
}
 | 
						|
 | 
						|
 | 
						|
.mvd-H2 {
 | 
						|
    font-family : Verdana, Arial, sans-serif;
 | 
						|
    font-size : 12.0pt;
 | 
						|
    color : blue;
 | 
						|
}
 | 
						|
 | 
						|
 | 
						|
p.indent {
 | 
						|
    font-family : "Verdana, Arial, sans-serif";
 | 
						|
    list-style-type : circle;
 | 
						|
    list-style-position : inside;
 | 
						|
    color : black;
 | 
						|
    margin-left : 16.0pt;
 | 
						|
}
 | 
						|
 | 
						|
 | 
						|
.mvd-P-indent {
 | 
						|
    font-family : Verdana, Arial, sans-serif;
 | 
						|
    list-style-type : circle;
 | 
						|
    list-style-position : inside;
 | 
						|
    color : black;
 | 
						|
    margin-left : 16.0pt;
 | 
						|
}
 | 
						|
 | 
						|
 | 
						|
pre.programlisting {
 | 
						|
    font-size : 9.0pt;
 | 
						|
    list-style-type : disc;
 | 
						|
    margin-left : 16.0pt;
 | 
						|
    margin-top : -14.0pt;
 | 
						|
}
 | 
						|
 | 
						|
 | 
						|
.mvd-PRE-programlisting {
 | 
						|
    font-size : 9.0pt;
 | 
						|
    list-style-type : disc;
 | 
						|
    margin-left : 16.0pt;
 | 
						|
    margin-top : -14.0pt;
 | 
						|
}
 | 
						|
 | 
						|
 | 
						|
.mvd-PRE {
 | 
						|
    font-size : 9.0pt;
 | 
						|
}
 | 
						|
 | 
						|
 | 
						|
p.note {
 | 
						|
    margin-left : 28.0pt;
 | 
						|
}
 | 
						|
 | 
						|
 | 
						|
.mvd-P-note {
 | 
						|
    margin-left : 28.0pt;
 | 
						|
}
 | 
						|
 | 
						|
 | 
						|
.mvd-H4 {
 | 
						|
    font-family : Verdana, Arial, sans-serif;
 | 
						|
    font-weight : normal;
 | 
						|
    font-size : 9.0pt;
 | 
						|
    color : black;
 | 
						|
    margin-left : 6.0pt;
 | 
						|
    margin-top : -14.0pt;
 | 
						|
}
 | 
						|
 | 
						|
 | 
						|
.mvd-P {
 | 
						|
    font-family : Verdana, Arial, sans-serif;
 | 
						|
    font-size : 10.0pt;
 | 
						|
    color : black;
 | 
						|
}
 | 
						|
 | 
						|
.mvd-BODY {
 | 
						|
    font-family : Verdana, Arial, sans-serif;
 | 
						|
    background-color : white;
 | 
						|
}
 | 
						|
 | 
						|
 | 
						|
p.indentnobullet {
 | 
						|
    font-family : Verdana, Arial, sans-serif;
 | 
						|
    list-style-type : none;
 | 
						|
}
 | 
						|
 | 
						|
 | 
						|
.mvd-P-indentnobullet {
 | 
						|
    font-family : Verdana, Arial, sans-serif;
 | 
						|
    list-style-type : none;
 | 
						|
}
 | 
						|
</style>
 | 
						|
 | 
						|
 | 
						|
</head>
 | 
						|
 | 
						|
<body style="background-color: white">
 | 
						|
 | 
						|
<p><a name="__index__"></a></p>
 | 
						|
<!-- INDEX BEGIN -->
 | 
						|
 | 
						|
<ul>
 | 
						|
 | 
						|
	<li><a href="#name">NAME</a></li>
 | 
						|
	<li><a href="#synopsis">SYNOPSIS</a></li>
 | 
						|
	<li><a href="#description">DESCRIPTION</a></li>
 | 
						|
	<ul>
 | 
						|
 | 
						|
		<li><a href="#inheritance">Inheritance</a></li>
 | 
						|
		<li><a href="#inheriting_from_multiple_locations">Inheriting from multiple locations</a></li>
 | 
						|
	</ul>
 | 
						|
 | 
						|
	<li><a href="#methods">METHODS</a></li>
 | 
						|
	<ul>
 | 
						|
 | 
						|
		<li><a href="#get_path">get_path</a></li>
 | 
						|
		<li><a href="#get_all_paths">get_all_paths</a></li>
 | 
						|
		<li><a href="#tree">tree</a></li>
 | 
						|
	</ul>
 | 
						|
 | 
						|
	<li><a href="#see_also">SEE ALSO</a></li>
 | 
						|
	<li><a href="#maintainer">MAINTAINER</a></li>
 | 
						|
	<li><a href="#copyright">COPYRIGHT</a></li>
 | 
						|
	<li><a href="#version">VERSION</a></li>
 | 
						|
</ul>
 | 
						|
<!-- INDEX END -->
 | 
						|
 | 
						|
<hr />
 | 
						|
<p>
 | 
						|
</p>
 | 
						|
<h1><a name="name">NAME</a></h1>
 | 
						|
<p>GT::Template::Inheritance - Provides GT::Template inheritance/local file
 | 
						|
determination.</p>
 | 
						|
<p>
 | 
						|
</p>
 | 
						|
<hr />
 | 
						|
<h1><a name="synopsis">SYNOPSIS</a></h1>
 | 
						|
<pre>
 | 
						|
    use GT::Template::Inheritance;</pre>
 | 
						|
<pre>
 | 
						|
    my $file = GT::Template::Inheritance->get_path(
 | 
						|
        file => "foo.htm",
 | 
						|
        path => "/path/to/my/template/set"
 | 
						|
    );</pre>
 | 
						|
<pre>
 | 
						|
    my @files = GT::Template::Inheritance->get_all_paths(
 | 
						|
        file => "foo.htm",
 | 
						|
        path => "/path/to/my/template/set"
 | 
						|
    );</pre>
 | 
						|
<pre>
 | 
						|
    my @paths = GT::Template::Inheritance->tree(
 | 
						|
        path => "/path/to/my/template/set"
 | 
						|
    );</pre>
 | 
						|
<p>
 | 
						|
</p>
 | 
						|
<hr />
 | 
						|
<h1><a name="description">DESCRIPTION</a></h1>
 | 
						|
<p>GT::Template::Inheritance provides an interface to accessing files for
 | 
						|
GT::Template template parsing and include handling.  It supports following
 | 
						|
inheritance directories and respects ``local'' template directories.</p>
 | 
						|
<p>
 | 
						|
</p>
 | 
						|
<h2><a name="inheritance">Inheritance</a></h2>
 | 
						|
<p>GT::Template inheritance works by looking for a .tplinfo file in the template
 | 
						|
directory (or local/.tplinfo, if it exists).  In order for the template
 | 
						|
directory to inherit from another template directory, this file must exist and
 | 
						|
must evaluate to a hash reference containing an <a href="#item_inheritance"><code>inheritance</code></a> key.  The
 | 
						|
following is a possible .tplinfo file contents:</p>
 | 
						|
<pre>
 | 
						|
    {
 | 
						|
        inheritance => '../other'
 | 
						|
    }</pre>
 | 
						|
<p>The above example would indicate that files in this template set can be
 | 
						|
inherited from the ../other path, relative to the current template set
 | 
						|
directory.  The inheritance directory may also contain a full path.</p>
 | 
						|
<p>
 | 
						|
</p>
 | 
						|
<h2><a name="inheriting_from_multiple_locations">Inheriting from multiple locations</a></h2>
 | 
						|
<p>You may also inherit from multiple locations by using an array reference for
 | 
						|
the inheritance value:</p>
 | 
						|
<pre>
 | 
						|
    {
 | 
						|
        inheritance => ['../other', '/full/path/to/a/third']
 | 
						|
    }</pre>
 | 
						|
<p>With the above .tplinfo file, files would be checked for in the current path,
 | 
						|
then <code>../other</code>, then any of <code>../other</code>'s inherited directories, then in
 | 
						|
<code>third</code>, then in any of <code>third</code>'s inherited directories.</p>
 | 
						|
<p>Also keep in mind that ``local'' directories, if they exist, will be checked for
 | 
						|
the file before each of their respective directories.</p>
 | 
						|
<p>Assuming that the initial template path was <code>/full/path/one</code>, and assuming
 | 
						|
that <code>../other</code> inherited from <code>../other2</code>, the directories checked would be
 | 
						|
as follows:</p>
 | 
						|
<pre>
 | 
						|
    /full/path/one/local
 | 
						|
    /full/path/one
 | 
						|
    /full/path/one/../other/local            # i.e. /full/path/other/local
 | 
						|
    /full/path/one/../other                  # i.e. /full/path/other
 | 
						|
    /full/path/one/../other/../other2/local  # i.e. /full/path/other2/local
 | 
						|
    /full/path/one/../other/../other2        # i.e. /full/path/other2
 | 
						|
    /full/path/to/a/third/local
 | 
						|
    /full/path/to/a/third</pre>
 | 
						|
<p>
 | 
						|
</p>
 | 
						|
<hr />
 | 
						|
<h1><a name="methods">METHODS</a></h1>
 | 
						|
<p>All methods in GT::Template::Inheritance are class methods.  Each method takes
 | 
						|
a hash of options as an argument.</p>
 | 
						|
<p>
 | 
						|
</p>
 | 
						|
<h2><a name="get_path">get_path</a></h2>
 | 
						|
<p>
 | 
						|
</p>
 | 
						|
<h2><a name="get_all_paths">get_all_paths</a></h2>
 | 
						|
<p>These methods are used to obtain the location of the file GT::Template will
 | 
						|
use, taking into account all inherited and ``local'' template directories.  The
 | 
						|
get_path option will return the path to the file that will be included, while
 | 
						|
the get_all_paths option returns the path to <strong>all</strong> copies of the file found in
 | 
						|
the local/inheritance tree.  Both methods take a hash containing the following:</p>
 | 
						|
<dl>
 | 
						|
<dt><strong><a name="item_file">file</a></strong><br />
 | 
						|
</dt>
 | 
						|
<dd>
 | 
						|
The name of the file desired.
 | 
						|
</dd>
 | 
						|
<p></p>
 | 
						|
<dt><strong><a name="item_path">path</a></strong><br />
 | 
						|
</dt>
 | 
						|
<dd>
 | 
						|
The template directory at which to start looking for the above file.  Depending
 | 
						|
on the existance of ``local'' directories and template inheritance, more than
 | 
						|
just this directory will be checked for the file.
 | 
						|
</dd>
 | 
						|
<p></p>
 | 
						|
<dt><strong><a name="item_local">local</a></strong><br />
 | 
						|
</dt>
 | 
						|
<dd>
 | 
						|
Optional.  Can be passed with a false value to override the checking of ``local''
 | 
						|
directories for files.
 | 
						|
</dd>
 | 
						|
<p></p>
 | 
						|
<dt><strong><a name="item_inheritance">inheritance</a></strong><br />
 | 
						|
</dt>
 | 
						|
<dd>
 | 
						|
Optional.  Can be passed with a false value to override the checking of
 | 
						|
inheritance directories for files.
 | 
						|
</dd>
 | 
						|
<p></p></dl>
 | 
						|
<p>
 | 
						|
</p>
 | 
						|
<h2><a name="tree">tree</a></h2>
 | 
						|
<p>This method returns a list of directories that would be searched for a given
 | 
						|
file, in the order they would be searched.  It takes the <a href="#item_path"><code>path</code></a>, <a href="#item_local"><code>local</code></a>, and
 | 
						|
<a href="#item_inheritance"><code>inheritance</code></a> options above, but not the <a href="#item_file"><code>file</code></a> option.</p>
 | 
						|
<p>
 | 
						|
</p>
 | 
						|
<hr />
 | 
						|
<h1><a name="see_also">SEE ALSO</a></h1>
 | 
						|
<p><a href="glist.cgi?do=admin_gtdoc&topic=/GT/Template.html">the GT::Template manpage</a></p>
 | 
						|
<p>
 | 
						|
</p>
 | 
						|
<hr />
 | 
						|
<h1><a name="maintainer">MAINTAINER</a></h1>
 | 
						|
<p>Jason Rhinelander</p>
 | 
						|
<p>
 | 
						|
</p>
 | 
						|
<hr />
 | 
						|
<h1><a name="copyright">COPYRIGHT</a></h1>
 | 
						|
<p>Copyright (c) 2005 Gossamer Threads Inc.  All Rights Reserved.
 | 
						|
<a href="http://www.gossamer-threads.com/">http://www.gossamer-threads.com/</a></p>
 | 
						|
<p>
 | 
						|
</p>
 | 
						|
<hr />
 | 
						|
<h1><a name="version">VERSION</a></h1>
 | 
						|
<p>Revision: $Id: Inheritance.pm,v 1.7 2005/02/09 20:51:27 jagerman Exp $</p>
 | 
						|
 | 
						|
</body>
 | 
						|
 | 
						|
</html>
 |