Text::...Default(3pm)

✨ NAME ✨

okay so bestie, gather round, because today we're talking about Text::Xslate::HashWithDefault β€” a whole helper class whose entire job is to fill in default values. that's it. that's the girl. she's the understudy who jumps in when the real value ghosted you πŸ’…


πŸŽ€ SYNOPSIS πŸŽ€

here's the vibe in code form, no cap:

use Text::Xslate::Util qw(hash_with_default);

my $hash_ref = hash_with_default({ }, sub { "FILLME('@_')" });
print $hash_ref->{foo}; # FILLME('foo')

so you pull in hash_with_default from Text::Xslate::Util, hand it an empty hash { } and a little sub that returns "FILLME('@_')", and then when you go looking for $hash_ref->{foo} β€” which totally isn't in there β€” the sub pops out and goes FILLME('foo'). it's giving substitute teacher who actually ate πŸ“šβœ¨


πŸ’– DESCRIPTION πŸ’–

so the whole tea is: this is a helper class, and it exists to provide the hash_with_default() functionality. that's its one job, its main character moment, its entire personality 🫢

and like, why would you even want that? because it's useful for debugging. that's literally the reason. when you're staring at a hash wondering where a value came from and the answer is "nowhere, it was never there," this is how you find out 🌸

if you want the full deep dive, go check Text::Xslate::Manual::Debugging β€” they explain the details over there πŸ‘‘

okay that's the whole page, short and sweet, an icon honestly πŸ’€βœ¨ this was Text::...Default(3pm) from perl v5.42.3, dated 2026-08-22 β€” mwah, slay, go debug something, ily πŸŽ€πŸ¦‹πŸ’œ

πŸ“¦ where this page comes from