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 =
13 $compiler->compile( comp_source => $source,
14 name => $comp_name,
15 comp_path => $comp_path,
16 );
17
19 This Compiler subclass generates Mason object code (Perl code). It is
20 the default Compiler class used by Mason.
21
23 All of these parameters are optional.
24
25 comp_class
26 The class into which component objects are blessed. This defaults
27 to HTML::Mason::Component.
28
29 subcomp_class
30 The class into which subcomponent objects are blessed. This
31 defaults to HTML::Mason::Component::Subcomponent.
32
33 in_package
34 This is the package in which a component's code is executed. For
35 historical reasons, this defaults to "HTML::Mason::Commands".
36
37 preamble
38 Text given for this parameter is placed at the beginning of each
39 component, but after the execution of any "<%once>" block. See also
40 postamble. The request will be available as $m in preamble code.
41
42 postamble
43 Text given for this parameter is placed at the end of each
44 component. See also preamble. The request will be available as $m
45 in postamble code.
46
47 use_strict
48 True or false, default is true. Indicates whether or not a given
49 component should "use strict".
50
51 use_warnings
52 True or false, default is false. Indicates whether or not a given
53 component should "use warnings".
54
55 named_component_subs
56 When compiling a component, use uniquely named subroutines for the
57 a component's body, subcomponents, and methods. Doing this allows
58 you to effectively profile Mason components. Without this, all
59 components simply show up as __ANON__ or something similar in the
60 profiler.
61
62 define_args_hash
63 One of "always", "auto", or "never". This determines whether or
64 not an %ARGS hash is created in components. If it is set to
65 "always", one is always defined. If set to "never", it is never
66 defined.
67
68 The default, "auto", will cause the hash to be defined only if some
69 part of the component contains the string "ARGS". This is somewhat
70 crude, and may result in some false positives, but this is
71 preferable to false negatives.
72
73 Not defining the args hash means that we can avoid copying
74 component arguments, which can save memory and slightly improve
75 execution speed.
76
78 All of the above properties have read-only accessor methods of the same
79 name. You cannot change any property of a compiler after it has been
80 created (but you can create multiple compilers with different
81 properties).
82
84 This class is primarily meant to be used by the Interpreter object, and
85 as such has a very limited public API.
86
87 compile(...)
88 This method will take component source and return the compiled
89 object code for that source. See "compile(...)" in
90 HTML::Mason::Compiler for details on this method.
91
92 This subclass also accepts a "comp_class" parameter, allowing you
93 to override the class into which the component is compiled.
94
95
96
97perl v5.32.1 2021-01-27HTML::Mason::Compiler::ToObject(3)