Is it possible to append subroutines to a Raku module at runtime?

131 Views Asked by At

I would like to be able to add a sub to a module Foo at runtime.

In Perl, I would do something like:

*{'My::Module::foo'} = \sub { 'FOO!' };

I know Raku doesn't have TypeGlobbing like Perl. Ideally it would be something like:

use MONKEY;

module Foo {};

Foo.^add-sub('foo', sub { 'FOO!' });

Is this possible?

1

There are 1 best solutions below

3
raiph On BEST ANSWER