Created
April 27, 2016 17:08
-
-
Save zoffixznet/f95da0224c863dd4d014f39539c6be24 to your computer and use it in GitHub Desktop.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
BEGIN my $JSON = q:to/END/; | |
{ | |
"name": "Bender", | |
"input": "beer" | |
} | |
END | |
multi sub trait_mod:<is> (Variable $v, :$config!) { | |
my $conf = from-json $JSON; | |
my $name = $v.var.VAR.name.substr: 1; | |
$v.var = $conf{ $name } // die 'Unknown configuration variable'; | |
} | |
my $name is config; | |
say $name; | |
my $input is config; | |
say $input; |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment