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 named_component_subs
52 When compiling a component, use uniquely named subroutines for the
53 a component's body, subcomponents, and methods. Doing this allows
54 you to effectively profile Mason components. Without this, all
55 components simply show up as __ANON__ or something similar in the
56 profiler.
57
58 define_args_hash
59 One of "always", "auto", or "never". This determines whether or
60 not an %ARGS hash is created in components. If it is set to
61 "always", one is always defined. If set to "never", it is never
62 defined.
63
64 The default, "auto", will cause the hash to be defined only if some
65 part of the component contains the string "ARGS". This is somewhat
66 crude, and may result in some false positives, but this is
67 preferable to false negatives.
68
69 Not defining the args hash means that we can avoid copying
70 component arguments, which can save memory and slightly improve
71 execution speed.
72
74 All of the above properties have read-only accessor methods of the same
75 name. You cannot change any property of a compiler after it has been
76 created (but you can create multiple compilers with different
77 properties).
78
80 This class is primarily meant to be used by the Interpreter object, and
81 as such has a very limited public API.
82
83 compile(...)
84 This method will take component source and return the compiled
85 object code for that source. See "compile(...)" in
86 HTML::Mason::Compiler for details on this method.
87
88 This subclass also accepts a "comp_class" parameter, allowing you
89 to override the class into which the component is compiled.
90
91
92
93perl v5.12.0 2010-05-03HTML::Mason::Compiler::ToObject(3)