16 May 2020 16:53:18 UTC
- Distribution: HTML-Mason
- Module version: 1.59
- Source (raw)
- Browse (raw)
- How to Contribute
- Issues (25)
- Testers (930 / 9 / 0)
- KwaliteeBus factor: 2
- 83.75% Coverage
- License: perl_5
- Activity24 month
- Download (316.08KB)
- MetaCPAN Explorer
- Subscribe to distribution
- This version
- Latest version++ed by:5 non-PAUSE usersDROLSKY Dave Rolsky
HTML::Mason::Compiler::ToObject - A Compiler subclass that generates Mason object code
my $compiler = HTML::Mason::Compiler::ToObject->new; my $object_code = $compiler->compile( comp_source => $source, name => $comp_name, comp_path => $comp_path, );
This Compiler subclass generates Mason object code (Perl code). It is the default Compiler class used by Mason.
All of these parameters are optional.
The class into which component objects are blessed. This defaults to HTML::Mason::Component.
The class into which subcomponent objects are blessed. This defaults to HTML::Mason::Component::Subcomponent.
This is the package in which a component's code is executed. For historical reasons, this defaults to
Text given for this parameter is placed at the beginning of each component, but after the execution of any
<%once>block. See also postamble. The request will be available as
$min preamble code.
Text given for this parameter is placed at the end of each component. See also preamble. The request will be available as
$min postamble code.
True or false, default is true. Indicates whether or not a given component should
True or false, default is false. Indicates whether or not a given component should
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.
One of "always", "auto", or "never". This determines whether or not an
%ARGShash is created in components. If it is set to "always", one is always defined. If set to "never", it is never defined.
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.
Not defining the args hash means that we can avoid copying component arguments, which can save memory and slightly improve execution speed.
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).
This class is primarily meant to be used by the Interpreter object, and as such has a very limited public API.
This method will take component source and return the compiled object code for that source. See "compile(...)" in HTML::Mason::Compiler for details on this method.
This subclass also accepts a
comp_classparameter, allowing you to override the class into which the component is compiled.