Sophie

Sophie

distrib > Mageia > 1 > i586 > by-pkgid > eba9ee0102c026cd24ee533776e4a6dd

perl-JavaScript-1.160.0-2.mga1.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: