Subject: | aliasing does not work as documented |
The documentation claims that the object_by_path method can
create an alias:
$js->object_by_path($path, [$newobj])
Get a pointer to an object with the path specified. Create it if
it's not there yet. If $newobj is provided, the ref is used to bind the
exist-
ing object to the name in $path.
When I ran:
use JavaScript::SpiderMonkey;
my $js = new JavaScript::SpiderMonkey;
$js->init;
$js->property_by_path('a.b.c.d.e.f',"ghijkl");
my $abcd = $js->object_by_path('a.b.c.d');
my $abcd2 = $js->object_by_path('abcd',$abcd);
print "Expecting ghijkl: [",$js->property_get('abcd.e.f'),"]\n";
__END__
I get:
perl -w alias_test.pl
Cannot find object abcd.e via SpiderMonkey at
/usr/lib/perl5/site_perl/5.8.6/i386-linux-thread-multi/JavaScript/SpiderMonkey.pm
line 506
Expecting ghijkl: []
Subject: | alias_test.pl |
use JavaScript::SpiderMonkey;
my $js = new JavaScript::SpiderMonkey;
$js->init;
$js->property_by_path('a.b.c.d.e.f',"ghijkl");
my $abcd = $js->object_by_path('a.b.c.d');
my $abcd2 = $js->object_by_path('abcd',$abcd);
print "Expecting ghijkl: [",$js->property_get('abcd.e.f'),"]\n";
__END__