HTML::...oObject(3pm)
π HTML::Mason::Compiler::ToObject π
okay so bestie, you're looking at the manual page for HTML::Mason::Compiler::ToObject(3pm) β that's the HTML::Mason::Compiler::ToObject module, straight out of the User Contributed Perl Documentation. It's a compiler subclass, it's giving very "translator but make it Perl," and honestly? iconic. Let's get into it. π¦
β¨ NAME β¨
HTML::Mason::Compiler::ToObject β a Compiler subclass that generates Mason object code. no cap, that's the whole vibe.
πΈ SYNOPSIS πΈ
my $compiler = HTML::Mason::Compiler::ToObject->new;
my $object_code =
$compiler->compile( comp_source => $source,
name => $comp_name,
comp_path => $comp_path,
);
like. look at her go. π
π DESCRIPTION π
This Compiler subclass generates Mason object code β aka Perl code, fr fr. And plot twist: it's the default Compiler class used by Mason. main character energy from day one, we love to see it. π
π«Ά PARAMETERS TO THE new() CONSTRUCTOR π«Ά
okay so all of these are optional. every single one. no pressure, no forced commitments, we're chill here. β¨
comp_classβ the class into which component objects get blessed. defaults toHTML::Mason::Component. πsubcomp_classβ the class into which subcomponent objects get blessed. defaults toHTML::Mason::Component::Subcomponent. yes there's a separate class for the subcomponents, they have their own little apartment. πin_packageβ this is the package where a component's code actually gets executed. and for historical reasons (iykyk), it defaults toHTML::Mason::Commands. don't question the ancestors, bestie. πpreambleβ whatever text you put here gets placed at the beginning of each component, but after the execution of any<%once>block. see alsopostamble. the request will be available as$min preamble code. πpostambleβ whatever text you put here gets placed at the end of each component. see alsopreamble. the request will be available as$min postamble code. πuse_strictβ true or false, default is true. tells you whether or not a given component shoulduse strict. (say yes. say yes.) β¨use_warningsβ true or false, default is false. tells you whether or not a given component shoulduse warnings. π¨named_component_subsβ when compiling a component, use uniquely named subroutines for the component's body, subcomponents, and methods. doing this lets you effectively profile Mason components. without it, all components just show up as__ANON__or something similar in the profiler. like ma'am, who ARE you?? πdefine_args_hashβ one of"always","auto", or"never". this determines whether or not an%ARGShash gets created in components. if it's set to"always", one is always defined. if it's 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 we can avoid copying component arguments, which can save memory and slightly improve execution speed. efficiency queen. π
β ACCESSOR METHODS β
all of the above properties have read-only accessor methods of the same name. so like, you can look, but you can't touch. π
you cannot change any property of a compiler after it has been created. periodt. (but you can create multiple compilers with different properties β build your own little compiler friend group, slay. π«Ά)
π METHODS π
this class is primarily meant to be used by the Interpreter object, and as such has a very limited public API. she's private like that. π€«
compile(...)β this method will take component source and return the compiled object code for that source. see"compile(...)"inHTML::Mason::Compilerfor details on this method. π
this subclass also accepts a comp_class parameter, allowing you to override the class into which the component is compiled. so like, you can customise. go off. π₯
ngl bestie, that's the whole page. every flag, every default, every little historical quirk β all present and accounted for. nothing dropped, nothing invented. π―
sign-off time: this lovely little page comes to you from perl v5.38.2, dated 2024-03-05, and it's filed under HTML::...oObject(3pm). bye bestie, go compile something gorgeous. π
β¨ππ¦
π¦ where this page comes from
- debian trixie: libhtml-mason-perl 1:1.60-2 Β· Artistic-1.0-Perl OR GPL-1.0-or-later
- ubuntu noble: libhtml-mason-perl 1:1.60-2 Β· Artistic-1.0-Perl OR GPL-1.0-or-later
- ubuntu resolute: libhtml-mason-perl 1:1.60-2 Β· Artistic-1.0-Perl OR GPL-1.0-or-later
- π girlified by deepseek-ai/DeepSeek-V4.1-Flash on : a language model's rewrite of the original, under its terms