Skip to content

Instantly share code, notes, and snippets.

@leedo
Created September 11, 2014 21:48
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save leedo/b629ec92b59b7d8551f1 to your computer and use it in GitHub Desktop.
Save leedo/b629ec92b59b7d8551f1 to your computer and use it in GitHub Desktop.
#!/usr/bin/env perl6
use v6;
use Inline::Perl5;
multi trait_mod:<is>(Mu:U $class, Str :$p5) {
my $i = Inline::Perl5.new;
$i.run("use $p5");
my @methods = $i.run("[grep \{{$p5}->can(\$_)\} keys %\{{$p5}::\}]");
# use MOP to add methods that delegate to $i.call
# maybe whitelist methods in trait args?
}
class DBI is p5("DBI");
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment