HTML::...::Lazy(3pm)

πŸ“¦
version 1.003 Β· 2 versions
  • 1.003 Β· debian bookworm, debian trixie, ubuntu noble, ubuntu resolute, ubuntu stonking (latest)
  • 1.003 Β· ubuntu jammy
, in debian bookworm, debian trixie, ubuntu noble, ubuntu resolute, ubuntu stonking

✨ NAME ✨

HTML::Template::Compiled::Lazy β€” Lazy Loading for HTML::Template::Compiled πŸ’…

okay so bestie, this is the 3pm manual page for HTML::...::Lazy, and it's giving exactly what it says on the tin: lazy loading, but make it iconic πŸ¦‹


🌸 SYNOPSIS 🌸

use HTML::Template::Compiled::Lazy;
my $htcl = HTML::Template::Compiled::Lazy->new(
    # usual parameters for HTML::Template::Compiled
);
$htcl->param(...);
# file wasn't compiled yet
print $htcl->output; # now compile and output!

see how it just sits there being all chill? πŸ‘‘ you set your params, you vibe, and nothing has happened yet. the compiling is on a whole other schedule, fr fr.


πŸŽ€ DESCRIPTION πŸŽ€

so the way this class works is: it does not compile templates before you call output(). like, at all. and yes, that includes TMPL_INCLUDEs β€” those get the same treatment. no cap πŸ’–

this can be useful in CGI environments, and here's the tea: if your template has got a lot of includes, HTML::Template::Compiled will compile all of them, even if they aren't needed because they are never reached (in a TMPL_IF, for example). literally compiling stuff you will never even look at?? wasted effort bestie, we don't do that here 🫢

also, HTML::Template::Compiled::Lazy won't complain if the file does not exist β€” it will complain when you call output(), though. so the drama is just delayed, not cancelled πŸ’€

so yeah, that's the whole vibe: defer the work, dodge the pointless compiles, and let the errors show up fashionably late. slay ✨

this page is from the User Contributed Perl Documentation, brought to you by perl v5.36.0, dated 2022-11-19. mwah, take care of her πŸ’–πŸŽ€πŸ¦‹

πŸ“¦ where this page comes from