2021-01-06 07:53:32 +01:00
|
|
|
#!/usr/bin/env perl
|
2021-01-06 20:47:33 +01:00
|
|
|
#
|
2021-01-06 07:53:32 +01:00
|
|
|
use strict;
|
|
|
|
use warnings;
|
|
|
|
|
|
|
|
use feature 'say';
|
|
|
|
|
|
|
|
use Peertube::DL::Javascript;
|
|
|
|
|
|
|
|
my $a = Peertube::DL::Javascript::_duk_create_heap_default();
|
|
|
|
if ( defined $a ) {
|
2021-01-07 16:02:34 +01:00
|
|
|
eval {
|
|
|
|
my $return = Peertube::DL::Javascript::_duk_eval_wrapper(
|
|
|
|
$a,
|
|
|
|
"function a(nombre) { return 'Hello ' + nombre; }; a('sergio');"
|
|
|
|
);
|
|
|
|
say $return;
|
|
|
|
};
|
|
|
|
if ($@) {
|
|
|
|
warn $@;
|
|
|
|
}
|
|
|
|
say Peertube::DL::Javascript::_duk_call_function( $a, "a", "sergio" );
|
|
|
|
Peertube::DL::Javascript::_duk_destroy_heap($a);
|
2021-01-06 20:47:33 +01:00
|
|
|
}
|