3
has $!here_we_keep_the_code_ref;
4
has $!other_place_we_could_keep_the_code_ref_in;
5
method set_code_ref($code_ref) {
6
$!here_we_keep_the_code_ref := $code_ref;
8
method set_code_ref_differently($code_ref) {
9
$!other_place_we_could_keep_the_code_ref_in := $code_ref;
14
nqp::setinvokespec(Foo,Foo,'$!here_we_keep_the_code_ref',nqp::null());
16
nqp::setinvokespec(Bar,Foo,'$!other_place_we_could_keep_the_code_ref_in',nqp::null());
19
$foo.set_code_ref(sub () {123});
20
$foo.set_code_ref_differently(sub () {456});
21
ok($foo() == 123,"basic setinvokespec");
24
$bar.set_code_ref(sub () {1001});
25
$bar.set_code_ref_differently(sub () {1002});
26
ok($bar() == 1002,"setinvokespec with a attribute in a subclass");