I think this is another *compile-time closure loses it's outer ctx at runtime* bug. I was trying to keep track of them: https://rt.perl.org/Public/Bug/Display.html?id=125634
Your lovely module has a compile time closure here (EXPORT Is called at compile time): https://github.com/zoffixznet/perl6-Pretty-Topic/blob/master/lib/Pretty/Topic.pm6#L8 If you actually did do: sub term:<♥> is export { $CALLER::_ } it would probably work. On Sat, Jun 25, 2016 at 11:19 PM Zoffix Znet <perl6-bugs-follo...@perl.org> wrote: > # New Ticket Created by Zoffix Znet > # Please include the string: [perl #128483] > # in the subject line of all future correspondence about this issue. > # <URL: https://rt.perl.org/Ticket/Display.html?id=128483 > > > > The Pretty::Topic module exports this sub: > > sub term:<♥> { $CALLER::_ } > > If a user-made module uses Pretty::Topic and invokes that sub, `Cannot > invoke this object` error occurs. The error goes away if the user-made > module has `no precompilation` pragma. The issue does not occur if the sub > term:<♥> { $CALLER::_ } is defined in a user-made module (and not something > installed with panda/zef) or if the Pretty::Topic is included in a script > and not a precompiled module: > > > $ tree > . > └── A.pm6 > > 0 directories, 1 file > > $ cat A.pm6 > unit class A; > use Pretty::Topic '♥'; > method update { say ♥ for ^4; } > > $ perl6 -I. -MA -e 'A.new.update' > Cannot invoke this object > in sub at sources/EDE2FE63DE5B1C96179DD91E427A5419C919578A > (Pretty::Topic) line 8 > in method update at /tmp/tmp.97W1AJFY3o/A.pm6 (A) line 3 > in block <unit> at -e line 1 > > $ pico A.pm6 > > $ cat A.pm6 > no precompilation; > unit class A; > use Pretty::Topic '♥'; > method update { say ♥ for ^4; } > > $ perl6 -I. -MA -e 'A.new.update' > 0 > 1 > 2 > 3 > $ > > $ perl6 -e 'use Pretty::Topic "♥"; say ♥ for ^4;' > 0 > 1 > 2 > 3 >