HTML::Mason::Compiler::ToObject - A Compiler subclass that generates Mason object code
| Use Case | Command | Description |
|---|---|---|
| Compile a component | $compiler->compile( comp_source => $source, name => $name, comp_path => $path ) | Compile Mason source into object code |
| Create a default compiler | my $compiler = HTML::Mason::Compiler::ToObject->new; | Instantiate the default Compiler class |
| Override component class | comp_class => 'My::Component' | Bless component objects into a custom class |
| Enable strict mode | use_strict => 1 | Add use strict to every component |
| Enable warnings | use_warnings => 1 | Add use warnings to every component |
Auto-detect %ARGS | define_args_hash => 'auto' | Only define %ARGS if the string ARGS appears in the component |
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.
HTML::Mason::Commands.<%once> block. See also postamble. The request will be available as $m in preamble code.$m in postamble code.use strict.use warnings.__ANON__ or something similar in the profiler.always, auto, or never. This determines whether or not an %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.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_class parameter, allowing you to override the class into which the component is compiled.
Generated by phpman v4.9.29 · Markdown · JSON · MCP Author: Che Dong Under GNU General Public License
2026-07-20 23:10 @216.73.216.114
CrawledBy Mozilla/5.0 AppleWebKit/537.36 (KHTML, like Gecko; compatible; ClaudeBot/1.0; +claudebot@anthropic.com)
Enhanced by LLM: deepseek-v4-flash / taotoken.net / www.chedong.com - original format