Skip to content

Commit 0073d24

Browse files
committed
don't set Duktape finalizer on internal perl methods
This cause a strange behaviour of not setting proper error string var $@
1 parent b8e63d6 commit 0073d24

File tree

1 file changed

+5
-1
lines changed

1 file changed

+5
-1
lines changed

lib/JavaScript/Duktape.pm

Lines changed: 5 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -175,7 +175,7 @@ sub new {
175175
return 1;
176176
};
177177

178-
$duk->push_perl_function($self->{call}, -1);
178+
$duk->push_perl_function($self->{call}, -1, 1);
179179
$duk->put_global_string('perlCall');
180180

181181
return $self;
@@ -512,6 +512,8 @@ sub push_c_function {
512512
my $self = shift;
513513
my $sub = shift;
514514
my $nargs = shift || -1;
515+
my $nofinalizer = shift;
516+
515517
$GlobalRef->{"$sub"} = sub {
516518
my @args = @_;
517519
my $top = $self->get_top();
@@ -546,6 +548,8 @@ sub push_c_function {
546548
};
547549

548550
$self->perl_push_function($GlobalRef->{"$sub"}, $nargs);
551+
552+
return if $nofinalizer;
549553
$self->eval_string("(function(){perlFinalizer('$sub')})");
550554
$self->set_finalizer(-2);
551555
}

0 commit comments

Comments
 (0)