Skip to content

Instantly share code, notes, and snippets.

@skids
Last active September 26, 2017 15:02
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save skids/08245ef93cf4cc78417affa78afe2a10 to your computer and use it in GitHub Desktop.
Save skids/08245ef93cf4cc78417affa78afe2a10 to your computer and use it in GitHub Desktop.
Using an nqp mod from a used Perl6 mod
$ cd /tmp/
$ cat > nqpmod.nqp
use nqp;
sub nqpsub(*@foo) is export { nqp::say("OHAI nqpsub") };
$ nqp --target=mbc --output=/tmp/nqpmod.moarvm --encoding=utf8 /tmp/nqpmod.nqp
$ NQP_LIB=/tmp/ nqp -e 'use nqpmod; nqpsub();'
OHAI nqpsub
$ cat > sixmod.pm6
use nqp;
use nqpmod:from<NQP>;
use Perl6::World:from<NQP>;
sub sixsub is export {
nqpsub(nqp::gethllsym('nqp', 'nqplist')());
}
$ NQP_LIB=/tmp/ PERL6LIB=/tmp/ perl6 --ll-exception -e 'use sixmod; sixsub()'
SC not yet resolved; lookup failed
at /tmp/sixmod.pm6 (sixmod):5 (/tmp/.precomp/BE558BBA8EFBC76F5B0517D79C1CD552B384E0EC.1506360367.38564/AE/AE73D44C9CDB1182D876A34E9EC0537C2CE87659:sixsub)
from -e:1 (<ephemeral file>:<unit>)
from -e:1 (<ephemeral file>:<unit-outer>)
from gen/moar/stage2/NQPHLL.nqp:1529 (/home/bri/.local/share/nqp/lib/NQPHLL.moarvm:eval)
from gen/moar/stage2/NQPHLL.nqp:1636 (/home/bri/.local/share/nqp/lib/NQPHLL.moarvm:)
from gen/moar/stage2/NQPHLL.nqp:1682 (/home/bri/.local/share/nqp/lib/NQPHLL.moarvm:command_eval)
from src/Perl6/Compiler.nqp:42 (/home/bri/.local/share/nqp/lib/Perl6/Compiler.moarvm:command_eval)
from gen/moar/stage2/NQPHLL.nqp:1617 (/home/bri/.local/share/nqp/lib/NQPHLL.moarvm:command_line)
from gen/moar/main.nqp:47 (/home/bri/.local/share/perl6/runtime/perl6.moarvm:MAIN)
from gen/moar/main.nqp:38 (/home/bri/.local/share/perl6/runtime/perl6.moarvm:<mainline>)
from <unknown>:1 (/home/bri/.local/share/perl6/runtime/perl6.moarvm:<main>)
from <unknown>:1 (/home/bri/.local/share/perl6/runtime/perl6.moarvm:<entry>)
$ NQP_LIB=/tmp/ PERL6LIB=/tmp/ perl6 --ll-exception -e 'use nqp; use nqpmod:from<NQP>; use Perl6::World:from<NQP>; nqpsub(nqp::gethllsym("nqp", "nqplist")());'
OHAI nqpsub
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment