gam3 has asked for the wisdom of the Perl Monks concerning the following question:
Am I doing something silly. Do I need a different version of the javascript (Spider Monkey) library.
#!/usr/bin/perl use strict; use JavaScript qw(:all); my $runtime = JavaScript::Runtime->new(); my $context = $runtime->create_context(); $context->bind_class( name => 'Loo', constructor => sub { print STDERR "x = x\n"; my $x = Foo->new(@_); print STDERR "x = $x\n"; return $x; }, 'package' => 'Foo' ); print $context->eval("new Loo();"); { package Foo; sub new { my $ret = bless { @_ }, 'Foo'; print "-new- (@_) $ret\n"; return $ret; } }
Update: removed Methods because they are not needed for example.
|
|---|
| Replies are listed 'Best First'. | |
|---|---|
|
Re: Segfault with JavaScript in Debian
by PodMaster (Abbot) on Apr 29, 2005 at 00:19 UTC | |
|
Re: Segfault with JavaScript in Debian
by injunjoel (Priest) on Apr 29, 2005 at 00:24 UTC | |
|
Re: Segfault with JavaScript in Debian
by Joost (Canon) on Apr 29, 2005 at 08:36 UTC | |
|
Re: Segfault with JavaScript in Debian
by gam3 (Curate) on May 04, 2005 at 00:25 UTC |