Question
converting list of Str into list of Enums
I have an enum definition in a module AAA
:
enum RDProcDebug <None All AstBlock BlockType Scoping Templates MarkUp>;
class Debug {
method foo(RDProcDebug @ds) {
for @ds { say .key ~ ' => ' ~ .value }
}
}
In Raku programs, this works well, eg
use AAA;
my RDProcDebug $rp .= new;
$r.foo(AstBlock, BlockType);
But now I need to supply the names of the debug elements from the command line, which can only supply Str, eg
$ RDOpts='AstBlock BlockType' raku myprog
# and in myprog
if %*ENV<RDOpts>:exists {
$rp.debug( %*ENV<RDOpts> ); # this does not work
}
So how do I convert a list of Str into a list of type enum RDProcDebug ?