JavaSc...unction(3pm)
β¨ NAME β¨
JavaScript::QuickJS::Function β it's a JavaScript Function but make it Perl π
(also it lives in the User Contributed Perl Documentation section, section 3pm, iykyk)
πΈ SYNOPSIS πΈ
my $func = JavaScript::QuickJS->new()->eval("() => 123");
print $func->(); # prints β123β; note overloading :)
okay bestie look at that last line again. $func->() β we're calling a JavaScript function with Perl syntax. that's the overloading. slay π
π¦ DESCRIPTION π¦
so basically this class is the Perl-side glow-up of a JavaScript Function instance.
the MDN link for the real thing is: https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Global_Objects/Function β go read it if you want the full lore, we're just the Perl wrapper π«Ά
important, no cap: this class is not instantiated directly. you don't new it yourself, it just shows up in your life when QuickJS hands you a function. main character energy but from the backstage β¨
π OVERLOADING π
for convenience (and because we love you), instances of this class are callable as Perl code references. π₯
that's literally equivalent to a call() with $this_sv (see below) set to undef. like, same thing, just with less typing.
there's an example up in the SYNOPSIS if you scrolled past it, go look π
π INVOCATION METHODS π
$ret = OBJ->call( $this_sv, @arguments )
does what JavaScript's method of the same name does. say it with me: like JavaScript's method of the same name. periodt. π
π ACCESSOR METHODS π
each one of these hands you back the matching JS property, no drama:
length()β returns the corresponding JS propertyname()β returns the corresponding JS property
that's the whole list, bestie, we keep it tight πΈ
and that's the whole page!! this one's from perl v5.42.3, dated 2026-08-19 β shoutout to whoever contributed it to the Perl docs, you ate πβ¨ππ¦πΈπ
π«Ά
π¦ where this page comes from
- ubuntu stonking: libjavascript-quickjs-perl 0.21-3build1 Β· 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