Mango:...N::Code(3pm)

πŸ“¦
version 1.30 Β· 3 versions
, in debian bookworm, debian trixie, ubuntu jammy, ubuntu noble, ubuntu resolute, ubuntu stonking

πŸ¦‹ Mango:...N::Code(3pm) β€” the manual page, but make it cute

okay bestie, so this is Mango::BSON::Code, a page from the User Contributed Perl Documentation collection. it's a lil tiny module, but it's lowkey doing important work. let's get into it πŸ’…


✨ NAME ✨

Mango::BSON::Code β€” it's a Code type. that's it. that's the whole vibe. a whole module whose entire personality is "i am code, but as a data type." iconic honestly πŸŽ€


🌸 SYNOPSIS 🌸

here's how you'd actually use this thing:

use Mango::BSON::Code;

my $code = Mango::BSON::Code->new(code => 'function () {}');

so you pull in the module, and then you build an object with new, handing it a code key whose value is your JavaScript. and that's... that's the whole intro. slay 🫢


πŸ’œ DESCRIPTION πŸ’œ

Mango::BSON::Code is a container for the BSON code type used by Mango::BSON.

like, it's a little wrapper box. BSON has a "code" type, right, and this module is the lil vessel that holds one. that's the job. it's giving very specific, very small, very necessary. main character energy on a small scale ✨


πŸ‘‘ ATTRIBUTES πŸ‘‘

Mango::BSON::Code implements the following attributes. (translation: these are the things you can get and set on your object, bestie.)

πŸ“ code

my $js = $code->code;
$code  = $code->code('function () {}');

this one's the JavaScript code. call it with no arguments and it hands you back the JS you stashed in there; call it with an argument and it sets a new one. classic accessor behaviour, no notes πŸ’…

🧚 scope

my $scode = $code->scope;
$code     = $code->scope({foo => 'bar'});

and this one is the Scope. same deal β€” read it with no args, write it with args. here the example drops in a hashref {foo => 'bar'}, so it's a little bag of variables that your code gets to live inside. cute, contained, very demure 🌈


πŸ’– METHODS πŸ’–

Mango::BSON::Code inherits all methods from Mojo::Base.

so literally everything else you'd expect? you already have it. no need to write it out, no need to stress. it's inherited. periodt πŸ‘‘


πŸ”₯ SEE ALSO πŸ”₯

go look at these if you want more of the lore:

iykyk 😌


πŸŽ€ cute sign-off πŸŽ€

and that's the whole page! this doc was generated by perl v5.30.3, dated 2020-06-05, and it's filed under the same name it started with β€” Mango:...N::Code(3pm), from the Perl user-contributed docs. ty for reading, go write some BSON code, mwah πŸ’‹πŸ’–