# New Ticket Created by Zoffix Znet
# Please include the string: [perl #131528]
# in the subject line of all future correspondence about this issue.
# <URL: https://rt.perl.org/Ticket/Display.html?id=131528 >
>From what I understand subs—even `only` subs—have another Sub playing the role
>of a dispatcher or whatever:
m: sub foo {}.WHERE.say; &foo.WHERE.say
rakudo-moar dbd0f8: OUTPUT: «139686084622776139686084191728»
And it seems when the sub itself, instead of this "dispatcher", is used in sub
EXPORT in a precompiled
module that's used by another precompiled module, some wires get crossed over
and the sub cannot be called:
m: sub foo {}.WHERE.say; &foo.WHERE.say
rakudo-moar dbd0f8: OUTPUT: «139686084622776139686084191728»
$ cat Foo.pm6
sub EXPORT {
Map.new: '&foo' => sub foo { say 42 }
}
$ cat Bar.pm6
use Foo;
foo
$ perl6 -I. -MFoo -e 'foo'
42
$ perl6 -I. -MBar -e ''
===SORRY!===
Cannot invoke this object (REPR: Null; VMNull)
$
Doing any of the following fixes the above bug:
- adding `no precompilation` to Foo.pm6
- adding `no precompilation` to Bar.pm6
- instead of using the sub directly, defining it separately and using `&foo` as
value in the Map