HTML::...:Utils(3pm)

✨ HTML::Mason::Utils(3pm) ✨

okay bestie, welcome to the group chat πŸ’… this is HTML::Mason::Utils, straight out of the User Contributed Perl Documentation corner of the perl universe. grab a strawberry πŸ“ and let's get into it.


🌸 NAME 🌸

HTML::Mason::Utils β€” these are Publicly available functions useful outside of Mason. yes, really, you're allowed to use them, they're not gatekept πŸ‘‘


πŸ¦‹ DESCRIPTION πŸ¦‹

so like, the functions in this module? they're the ones you want when you need to interface code you have written with Mason. that's the whole vibe. you wrote some code, it lives outside Mason, and now it needs to talk to Mason. these are the little connectors that make that happen 🫢


πŸŽ€ FUNCTIONS πŸŽ€

πŸ’– data_cache_namespace ($comp_id)

okay so you hand this one a component id, and it gives you back that component's default Cache::Cache namespace. iconic behavior honestly ✨

and why do you care? because it means you can access the cached data outside of Mason. no cap, that's the whole point β€” your code out here in the wild can go touch the same cache πŸ’…

now, the component id situation depends on your roots, so listen up:

  • with a single component root, the component id is just the component path. simple. clean. slay.
  • with multiple component roots, the component id is "key"/"path", where key is the key corresponding to the root that the component falls under. so you need both pieces, don't skip the key bestie πŸ™ˆ

🧚 cgi_request_args ($cgi, $method)

this one expects two things from you: a CGI.pm object, and the request method (GET, POST, etc). give it those two things and it's going to give you back... a hash πŸ’€ (in list context) or a hashref (in scalar context). either way you eat 🍽️

what's in that hash(ref)? all the arguments passed via the CGI request. and the structure is:

  • the keys are argument names
  • the values are either scalars or array references

that's it, that's the tea β˜•


πŸ’œ a lil sign-off πŸ’œ

this whole thing is perl v5.38.2, dated 2024-03-05, and it ships as HTML::Mason::Utils(3pm) under User Contributed Perl Documentation. periodt. go forth and interface your code with Mason, main character πŸ’…πŸŒˆβ­

πŸ“¦ where this page comes from