Skip to content

Instantly share code, notes, and snippets.

@FCO
Created December 13, 2016 17:19
Show Gist options
  • Save FCO/1561729d83b6737363ee871d90199184 to your computer and use it in GitHub Desktop.
Save FCO/1561729d83b6737363ee871d90199184 to your computer and use it in GitHub Desktop.
MacBook-Pro-de-Fernando:test fernando$ cat ToUse.pm6
unit class ToUse;
has %!bla;
my $instance = ::?CLASS.bless;
method new {!!!}
method instance {
$instance
}
method getBla is export {
%!bla
}
MacBook-Pro-de-Fernando:test fernando$ cat Use.pm6
unit module Use;
use ToUse;
BEGIN {
ToUse.instance.getBla()<test> = 42;
}
MacBook-Pro-de-Fernando:test fernando$ cat main.p6
use Use;
use ToUse;
say ToUse.instance.getBla
MacBook-Pro-de-Fernando:test fernando$ perl6 -I. main.p6
{}
MacBook-Pro-de-Fernando:test fernando$
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment