File: Resolver.html

package info (click to toggle)
libhtml-mason-perl 1%3A1.39-1
  • links: PTS
  • area: main
  • in suites: lenny
  • size: 2,072 kB
  • ctags: 1,535
  • sloc: perl: 17,624; sh: 187; makefile: 12
file content (129 lines) | stat: -rw-r--r-- 4,239 bytes parent folder | download | duplicates (2)
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
<?xml version="1.0" ?>
<!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>
<meta http-equiv="content-type" content="text/html; charset=utf-8" />
<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>

<dd>
<p>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.</p>
</dd>
</li>
<dt><strong><A NAME="item_get_info">get_info</a></strong>

<dd>
<p>Takes three arguments: an absolute component path, a component root key,
and a component root path. Returns a new
<a HREF="ComponentSource.html">HTML::Mason::ComponentSource</a> object.</p>
</dd>
</li>
<dt><strong><A NAME="item_glob_path">glob_path</a></strong>

<dd>
<p>Takes two arguments: a path glob pattern, something
like ``/foo/*'' or ``/foo/*/bar'', and a component root path. Returns
a list of component paths for components which match this glob pattern.</p>
</dd>
<dd>
<p>For example, the filesystem resolver simply appends this pattern to
the component root path and calls the Perl <code>glob()</code> function to
find matching files on the filesystem.</p>
</dd>
</li>
</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.</p>
<dl>
<dt><strong><A NAME="item_apache_request_to_comp_path">apache_request_to_comp_path ($r, @comp_root_array)</a></strong>

<dd>
<p>This method, given an Apache object and a list of component root pairs,
should return a component path or undef if none exists.
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>.</p>
</dd>
</li>
</dl>
<p>
</p>
<hr />
<h1><A NAME="see_also">SEE ALSO</a></h1>
<p><a HREF="Mason.html">HTML::Mason</a></p>

</body>

</html>