man HTML::Mason::Compiler::ToObject () - A Compiler subclass that generates Mason object code
NAME
HTML::Mason::Compiler::ToObject - A Compiler subclass that generates Mason object code
SYNOPSIS
my $compiler = HTML::Mason::Compiler::ToObject->new;
my $object_code = $compiler->compile( comp_source => $source, name => $comp_name );
DESCRIPTION
This Compiler subclass generates Mason object code (Perl code). It is the default Compiler class used by Mason.
PARAMETERS TO THE new() CONSTRUCTOR
All of these parameters are optional.
- comp_class
- The class into which component objects are blessed. This defaults to HTML::Mason::Component.
- subcomp_class
- The class into which subcomponent objects are blessed. This defaults to HTML::Mason::Component::Subcomponent.
- in_package
- This is the package in which a component's code is executed. For historical reasons, this defaults to CWHTML::Mason::Commands.
- preamble
- Text given for this parameter is placed at the beginning of each component, but after the execution of any CW<%once> block. See also postamble. The request will be available as CW$m in preamble code.
- postamble
- Text given for this parameter is placed at the end of each component. See also preamble. The request will be available as CW$m in postamble code.
- use_strict
- True or false, default is true. Indicates whether or not a given component should CWuse strict.
- define_args_hash
- One of always, auto, or never. This determines whether or not an CW%ARGS hash 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.
ACCESSOR METHODS
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).
METHODS
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. The CWcomp_source and CWname parameters are optional. The CWcomp_class can be used to change the component class for this one comonent.