1HTML::Mason::Compiler::UTsoeOrbjCeocntt(r3i)buted Perl DHoTcMuLm:e:nMtaastoino:n:Compiler::ToObject(3)
2
3
4
6 HTML::Mason::Compiler::ToObject - A Compiler subclass that generates
7 Mason object code
8
10 my $compiler = HTML::Mason::Compiler::ToObject->new;
11
12 my $object_code = $compiler->compile( comp_source => $source, name => $comp_name );
13
15 This Compiler subclass generates Mason object code (Perl code). It is
16 the default Compiler class used by Mason.
17
19 All of these parameters are optional.
20
21 comp_class
22 The class into which component objects are blessed. This defaults
23 to HTML::Mason::Component.
24
25 subcomp_class
26 The class into which subcomponent objects are blessed. This
27 defaults to HTML::Mason::Component::Subcomponent.
28
29 in_package
30 This is the package in which a component's code is executed. For
31 historical reasons, this defaults to "HTML::Mason::Commands".
32
33 preamble
34 Text given for this parameter is placed at the beginning of each
35 component, but after the execution of any "<%once>" block. See also
36 postamble. The request will be available as $m in preamble code.
37
38 postamble
39 Text given for this parameter is placed at the end of each compo‐
40 nent. See also preamble. The request will be available as $m in
41 postamble code.
42
43 use_strict
44 True or false, default is true. Indicates whether or not a given
45 component should "use strict".
46
47 define_args_hash
48 One of "always", "auto", or "never". This determines whether or
49 not an %ARGS hash is created in components. If it is set to
50 "always", one is always defined. If set to "never", it is never
51 defined.
52
53 The default, "auto", will cause the hash to be defined only if some
54 part of the component contains the string "ARGS". This is somewhat
55 crude, and may result in some false positives, but this is prefer‐
56 able to false negatives.
57
58 Not defining the args hash means that we can avoid copying compo‐
59 nent arguments, which can save memory and slightly improve execu‐
60 tion speed.
61
63 All of the above properties have read-only accessor methods of the same
64 name. You cannot change any property of a compiler after it has been
65 created (but you can create multiple compilers with different proper‐
66 ties).
67
69 This class is primarily meant to be used by the Interpreter object, and
70 as such has a very limited public API.
71
72 compile (comp_source => $source, name => $name, comp_class =
73 $comp_class)
74 This method will take component source and return the compiled
75 object code for that source. The "comp_source" and "name" parame‐
76 ters are optional. The "comp_class" can be used to change the com‐
77 ponent class for this one comonent.
78
79
80
81perl v5.8.8 2007-04-17HTML::Mason::Compiler::ToObject(3)