Skip to content

Instantly share code, notes, and snippets.

@adaptiveoptics
Created November 17, 2016 06:47
Show Gist options
  • Save adaptiveoptics/3df583b4a14486923b1a6e66a0d4eb1f to your computer and use it in GitHub Desktop.
Save adaptiveoptics/3df583b4a14486923b1a6e66a0d4eb1f to your computer and use it in GitHub Desktop.
use v6;
use MONKEY-SEE-NO-EVAL;
my $env = %*ENV;
class B {
method wrap(Callable $app) returns Callable {
my Callable $_app = $app;
return $_app;
}
}
class C {
method !mkapp() {
EVAL('sub app($env) {
return "I have output"
}
my $b = B.new;
$b.wrap(&app);');
}
method run() {
my &app = self!mkapp;
return &app;
}
}
my $c = C.new;
while True {$c.run};
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment