JavaScript::QuickJS::Function - JavaScript `Function` in Perl
Contents
Accessor Methods
The following methods return their corresponding JS property:
• length()
• name()
perl v5.40.0 2024-10-20 JavaScript::QuickJS::Function(3pm)
Description
This class represents a JavaScript Function <https://developer.mozilla.org/en-
US/docs/Web/JavaScript/Reference/Global_Objects/Function> instance in Perl.
This class is not instantiated directly.
Invocation Methods
$ret=OBJ->call($this_sv,@arguments)
Like JavaScript’s method of the same name.
Name
JavaScript::QuickJS::Function - JavaScript `Function` in Perl
Overloading
For convenience, instances of this class are callable as Perl code references. This is equivalent to a
call() with $this_sv (see below) set to undef.
See the "SYNOPSIS" above for an example.
Synopsis
my $func = JavaScript::QuickJS->new()->eval("() => 123");
print $func->(); # prints “123”; note overloading :)
