CGI::A...Handler(3pm)
π CGI::A...Handler(3pm) π
okay bestie, real talk: this is the user-contributed Perl documentation for a page whose manual name is literally CGI::A...Handler(3pm) (yes, it's truncated like that, the terminal did its little thing, we move on π ).
β¨ NAME β¨
CGI::Application::Plugin::AnyTemplate::ComponentHandler β it embeds run modes inside a template π«Ά
πΈ DESCRIPTION πΈ
so this is a lil helper module that CGI::Application::Plugin::AnyTemplate uses to do the grunt work: finding the run modes for embedded components, running them, and handing back their content. she's the backstage crew, the ones making sure the run mode hits its mark on cue π
ngl bestie, you do NOT need to touch this module directly unless you're out here adding support for a brand new template system. that's the only reason. periodt.
and if you want the actual tea on embedded components? that lives in the docs for CGI::Application::Plugin::AnyTemplate. go read those, she ate π
π¦ METHODS π¦
new
creates a shiny new CGI::Application::Plugin::AnyTemplate::ComponentHandler object. iconic behaviour only β¨
my $component_handler = CGI::Application::Plugin::AnyTemplate::ComponentHandler->new(
webapp => $webapp,
containing_template => $template,
);
- the
webappparameter should be a reference to aCGI::Applicationobject π - the
containing_templateparameter should be a reference to the template object that this component is embedded in π§
embed
runs the specified runmode of the webapp object. returns the results of this call, no cap π―
whatever parameters you pass to embed get passed on to the run mode, fr fr π¬
okay so here's the lil plot twist: if the results are a scalar reference, then the return value is dereferenced before returning. and honestly? this is the safest way of calling a run mode, because you'll get the output as a string and return it as a string. the catch (because there's always a catch π) is that it involves returning potentially very large strings from subroutines. so it's giving safe but also giving memory stress, iykyk π
embed_direct
runs the specified runmode of the webapp object. returns the results of this call, same energy as before π
parameters passed to embed_direct should be passed on to the run mode, obviously π
BUT β and this is the important part β even if the result of this call is a scalar reference, the result is NOT dereferenced before returning it. not dereferenced. none of that. you get the raw thing π₯
so if you call this method instead of embed, you better be careful to deal with the possibility that your results are a reference to a string and not the string itself. that's on you, bestie π
π AUTHOR π
Michael Graham, <mgraham@cpan.org> β we stan π«Ά
π COPYRIGHT & LICENSE π
Copyright 2005 Michael Graham, All Rights Reserved.
This program is free software; you can redistribute it and/or modify it under the same terms as Perl itself. slay, open source royalty β¨
and that's the whole page, bestie β this one came from perl v5.30.3 and was dated 2020-10-26, so go forth and embed those run modes responsibly πππ¦
π¦ where this page comes from
- debian bookworm: libcgi-application-plugin-anytemplate-perl 0.18-3 Β· Artistic-1.0-Perl OR GPL-1.0-or-later
- debian trixie: libcgi-application-plugin-anytemplate-perl 0.18-3 Β· Artistic-1.0-Perl OR GPL-1.0-or-later
- ubuntu jammy: libcgi-application-plugin-anytemplate-perl 0.18-3 Β· Artistic-1.0-Perl OR GPL-1.0-or-later
- ubuntu noble: libcgi-application-plugin-anytemplate-perl 0.18-3 Β· Artistic-1.0-Perl OR GPL-1.0-or-later
- ubuntu resolute: libcgi-application-plugin-anytemplate-perl 0.18-3 Β· Artistic-1.0-Perl OR GPL-1.0-or-later
- ubuntu stonking: libcgi-application-plugin-anytemplate-perl 0.18-3 Β· 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