Sophie

Sophie

distrib > Mandriva > 2010.1 > x86_64 > media > contrib-release-src > by-pkgid > 3c6fc877ba42fa887106ec13fa2dbe37

perl-JavaScript-1.160.0-1mdv2010.1.src.rpm

Description:

JavaScript.pm is an interface to the SpiderMonkey JS engine. It lets you execute JS code,
call JS functions, bind Perl classes to JS, import Perl functions to JS, precompile and exeute
scripts among many other things. It does conversion between Perl and JS datatypes.

use JavaScript;

my $rt = JavaScript::Runtime->new();
my $cx = $rt->create_context();

$cx->bind_function(write => sub { print @_; });

$cx->eval(q/
for (i = 99; i > 0; i--) {
write(i + " bottle(s) of beer on the wall, " + i + " bottle(s) of beer\n");
write("Take 1 down, pass it around, ");
if (i > 1) {
write((i - 1) + " bottle(s) of beer on the wall.");
}
else {
write("No more bottles of beer on the wall!");
}
}
/);

Generated packages:

Other version of this rpm: