# New Ticket Created by Benjamin Goldberg
# Please include the string: [perl #132045]
# in the subject line of all future correspondence about this issue.
# <URL: https://rt.perl.org/Ticket/Display.html?id=132045 >
The following code samples work as expected:
<BenGoldberg> m: use MONKEY; my $m = 'foo'; my $p = EVAL qq!role ::
[\$value] \{ method $m \{ \$value } }!; say $p.^parameterize(42).foo;
<+camelia> rakudo-moar e7a588: OUTPUT: «42»
<BenGoldberg> m: use MONKEY; constant $p = do { my $m = 'foo'; EVAL qq!role
:: [\$value] \{ method $m \{ \$value } }! }; say $p.^parameterize(42).foo
<camelia> rakudo-moar e7a588: OUTPUT: «42»
<BenGoldberg> m: use MONKEY; constant p = do { my $m = 'foo'; EVAL qq!role
:: [\$value] \{ method $m \{ \$value } }! }; say p[42].foo
<camelia> rakudo-moar e7a588: OUTPUT: «42»
The following, slightly different code samples do not work as expected:
m: use MONKEY; my $m = 'foo'; my $p = EVAL qq!role :: [\$value] \{ method $m
\{ \$value } }!; say $p[42].foo;
<+camelia> rakudo-moar e7a588: OUTPUT: «Could not instantiate role
'<anon|67928256>':Too few positionals passed; expected 2 arguments but got
1 in any protect at gen/moar/stage2/NQPCORE.setting line 1033 in block
<unit> at <tmp> line 1»
<BenGoldberg> m: use MONKEY; constant $p = do { my $m = 'foo'; EVAL qq!role
:: [\$value] \{ method $m \{ \$value } }! }; say $p[42].foo
<camelia> rakudo-moar e7a588: OUTPUT: «Could not instantiate role
'<anon|77207648>':Too few positionals passed; expected 2 arguments but got
1 in any protect at gen/moar/stage2/NQPCORE.setting line 1033 in block
<unit> at <tmp> line 1»
<BenGoldberg> m: use MONKEY; my \p = do { my $m = 'foo'; EVAL qq!role ::
[\$value] \{ method $m \{ \$value } }! }; say p[42].foo
<camelia> rakudo-moar e7a588: OUTPUT: «Could not instantiate role
'<anon|81583168>':Too few positionals passed; expected 2 arguments but got
1 in any protect at gen/moar/stage2/NQPCORE.setting line 1033 in block
<unit> at <tmp> line 1»