1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 53 54 55 56 57 58 59 60 61 62 63 64 65 66 67 68 69 70 71 72 73 74 75 76 77 78 79 80 81 82 83 84 85 86 87 88 89 90 91 92 93 94 95 96 97 98 99 100 101 102 103 104 105 106 107 108 109 110 111 112 113 114 115 116 117 118 119 120 121 122 123 124 125 126 127 128 129
|
<!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>HTML::Mason::Resolver - Component path resolver base class</title>
<link rev="made" href="mailto:root@localhost" />
</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>
<li><A HREF="#class__container">Class::Container</a></li>
<li><A HREF="#methods">METHODS</a></li>
<ul>
<li><A HREF="#using_a_resolver_with_html__maso">Using a Resolver with HTML::Mason::ApacheHandler</a></li>
</ul>
<li><A HREF="#see_also">SEE ALSO</a></li>
</ul>
<!-- INDEX END -->
<hr />
<p>
</p>
<h1><A NAME="name">NAME</a></h1>
<p>HTML::Mason::Resolver - Component path resolver base class</p>
<p>
</p>
<hr />
<h1><A NAME="synopsis">SYNOPSIS</a></h1>
<pre>
# make a subclass and use it</pre>
<p>
</p>
<hr />
<h1><A NAME="description">DESCRIPTION</a></h1>
<p>The resolver is responsible for translating a component path like
/foo/index.html into a component. By default, Mason expects
components to be stored on the filesystem, and uses the
HTML::Mason::Resolver::File class to get information on these
components.</p>
<p>The HTML::Mason::Resolver provides a virtual parent class from which
all resolver implementations should inherit.</p>
<p>
</p>
<hr />
<h1><A NAME="class__container">Class::Container</a></h1>
<p>This class is used by most of the Mason object's to manage constructor
parameters and has-a relationships with other objects.</p>
<p>See the documentation on this class for details on how to declare what
paremeters are valid for your subclass's constructor.</p>
<p>HTML::Mason::Resolver is a subclass of Class::Container so you
do not need to subclass it yourself.</p>
<p>
</p>
<hr />
<h1><A NAME="methods">METHODS</a></h1>
<p>If you are interested in creating a resolver subclass, you must
implement the following methods.</p>
<dl>
<dt><strong><A NAME="item_new">new</a></strong><br />
</dt>
<dd>
This method is optional. The new method included in this class is
simply inherited from <code>Class::Container</code>.
If you need something more complicated done in your new method you
will need to override it in your subclass.
</dd>
<p></p>
<dt><strong><A NAME="item_get_info">get_info</a></strong><br />
</dt>
<dd>
Given an absolute component path, returns a new
<a HREF="ComponentSource.html">HTML::Mason::ComponentSource</a> object.
</dd>
<p></p>
<dt><strong><A NAME="item_glob_path">glob_path</a></strong><br />
</dt>
<dd>
The only argument to this method is a path glob pattern, something
like ``/foo/*'' or ``/foo/*/bar''. Given this path, it should return a
list of component paths for components which match this glob pattern.
</dd>
<dd>
<p>For example, the filesystem resolver simply appends this pattern to
each component root in turn and calls the Perl <code>glob()</code> function to
find matching files on the filesystem.</p>
</dd>
<p></p></dl>
<p>
</p>
<h2><A NAME="using_a_resolver_with_html__maso">Using a Resolver with HTML::Mason::ApacheHandler</a></h2>
<p>If you are creating a new resolver that you intend to use with the
<a HREF="ApacheHandler.html">HTML::Mason::ApacheHandler</a> module, then
you must implement the following method as well, possibly in a
different subclass.</p>
<dl>
<dt><strong><A NAME="item_apache_request_to_comp_path">apache_request_to_comp_path ($r)</a></strong><br />
</dt>
<dd>
This method, given an Apache object, should return a component path.
This method is used by the
<a HREF="ApacheHandler.html">HTML::Mason::ApacheHandler</a> class to
translate web requests into component paths. You can omit this method
if your resolver subclass will never be used in conjunction with
<a HREF="ApacheHandler.html">HTML::Mason::ApacheHandler</a>.
</dd>
<p></p></dl>
<p>For example, Mason includes the
<a HREF="Resolver/File.html">HTML::Mason::Resolver::File</a> and
HTML::Mason::Resolver::File::ApacheHandler classes. The latter simply
adds an implementation of the <A HREF="#item_apache_request_to_comp_path"><code>apache_request_to_comp_path</code></a> method
for file based components.</p>
<p>
</p>
<hr />
<h1><A NAME="see_also">SEE ALSO</a></h1>
<p><a HREF="Mason.html">HTML::Mason</a></p>
</body>
</html>
|