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 130 131 132 133 134 135 136 137 138 139 140 141 142 143 144 145 146 147 148 149 150 151 152 153 154 155 156
|
<?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::Compiler::ToObject - A Compiler subclass that generates Mason object code</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="#parameters_to_the_new___construc">PARAMETERS TO THE <code>new()</code> CONSTRUCTOR</a></li>
<li><A HREF="#accessor_methods">ACCESSOR METHODS</a></li>
<li><A HREF="#methods">METHODS</a></li>
</ul>
<!-- INDEX END -->
<hr />
<p>
</p>
<h1><A NAME="name">NAME</a></h1>
<p>HTML::Mason::Compiler::ToObject - A Compiler subclass that generates Mason object code</p>
<p>
</p>
<hr />
<h1><A NAME="synopsis">SYNOPSIS</a></h1>
<pre>
my $compiler = HTML::Mason::Compiler::ToObject->new;</pre>
<pre>
my $object_code =
$compiler->compile( comp_source => $source,
name => $comp_name,
comp_path => $comp_path,
);</pre>
<p>
</p>
<hr />
<h1><A NAME="description">DESCRIPTION</a></h1>
<p>This Compiler subclass generates Mason object code (Perl code). It is
the default Compiler class used by Mason.</p>
<p>
</p>
<hr />
<h1><A NAME="parameters_to_the_new___construc">PARAMETERS TO THE <code>new()</code> CONSTRUCTOR</a></h1>
<p>All of these parameters are optional.</p>
<dl>
<dt><strong><A NAME="item_comp_class">comp_class</a></strong>
<dd>
<p>The class into which component objects are blessed. This defaults to
<a HREF="../Component.html">HTML::Mason::Component</a>.</p>
</dd>
</li>
<dt><strong><A NAME="item_subcomp_class">subcomp_class</a></strong>
<dd>
<p>The class into which subcomponent objects are blessed. This defaults
to <a HREF="../Component/Subcomponent.html">HTML::Mason::Component::Subcomponent</a>.</p>
</dd>
</li>
<dt><strong><A NAME="item_in_package">in_package</a></strong>
<dd>
<p>This is the package in which a component's code is executed. For
historical reasons, this defaults to <code>HTML::Mason::Commands</code>.</p>
</dd>
</li>
<dt><strong><A NAME="item_preamble">preamble</a></strong>
<dd>
<p>Text given for this parameter is placed at the beginning of each
component, but after the execution of any <code><%once></code> block. See
also <A HREF="../Params.html#postamble">postamble</a>. The request will be available as <code>$m</code> in preamble
code.</p>
</dd>
</li>
<dt><strong><A NAME="item_postamble">postamble</a></strong>
<dd>
<p>Text given for this parameter is placed at the end of each
component. See also <A HREF="../Params.html#preamble">preamble</a>. The request will be available as
<code>$m</code> in postamble code.</p>
</dd>
</li>
<dt><strong><A NAME="item_use_strict">use_strict</a></strong>
<dd>
<p>True or false, default is true. Indicates whether or not a given
component should <A HREF="#item_use_strict"><code>use strict</code></a>.</p>
</dd>
</li>
<dt><strong><A NAME="item_named_component_subs">named_component_subs</a></strong>
<dd>
<p>When compiling a component, use uniquely named subroutines for the a
component's body, subcomponents, and methods. Doing this allows you to
effectively profile Mason components. Without this, all components
simply show up as __ANON__ or something similar in the profiler.</p>
</dd>
</li>
<dt><strong><A NAME="item_define_args_hash">define_args_hash</a></strong>
<dd>
<p>One of ``always'', ``auto'', or ``never''. This determines whether or not
an <code>%ARGS</code> hash is created in components. If it is set to ``always'',
one is always defined. If set to ``never'', it is never defined.</p>
</dd>
<dd>
<p>The default, ``auto'', will cause the hash to be defined only if some
part of the component contains the string ``ARGS''. This is somewhat
crude, and may result in some false positives, but this is preferable
to false negatives.</p>
</dd>
<dd>
<p>Not defining the args hash means that we can avoid copying component
arguments, which can save memory and slightly improve execution speed.</p>
</dd>
</li>
</dl>
<p>
</p>
<hr />
<h1><A NAME="accessor_methods">ACCESSOR METHODS</a></h1>
<p>All of the above properties have read-only accessor methods of the
same name. You cannot change any property of a compiler after it has
been created (but you can create multiple compilers with different
properties).</p>
<p>
</p>
<hr />
<h1><A NAME="methods">METHODS</a></h1>
<p>This class is primarily meant to be used by the Interpreter object,
and as such has a very limited public API.</p>
<dl>
<dt><strong><A NAME="item_compile">compile (comp_source => $source, name => $name, comp_class = $comp_class)</a></strong>
<dd>
<p>This method will take component source and return the compiled object
code for that source. The <code>comp_source</code> and <code>name</code> parameters are
optional. The <A HREF="#item_comp_class"><code>comp_class</code></a> can be used to change the component class
for this one comonent.</p>
</dd>
</li>
</dl>
</body>
</html>
|