Why not adopt me?
NAME
Perl::ToPerl6::Transformer::BasicTypes::Strings::Interpolation - Format ${x}
correctly
AFFILIATION
This Transformer is part of the core Perl::ToPerl6 distribution.
DESCRIPTION
In Perl6, contents inside {} are now executable code. That means that inside interpolated strings, "${x}"
will be parsed as "${x()}"
and throw an exception if x()
is not defined. As such, this transforms "${x}"
into "{$x}"
:
"The $x bit" --> "The $x bit"
"The $x-30 bit" --> "The $x\-30 bit"
"\N{FOO}" --> "\c[FOO]"
"The \l$x bit" --> "The {lc $x} bit"
"The \v bit" --> "The bit"
"The ${x}rd bit" --> "The {$x}rd bit"
"The \${x}rd bit" --> "The \$\{x\}rd bit"
Many other transforms are performed in this module, see the code for a better idea of how complex this transformation really is.
Transforms only interpolated strings outside of comments, heredocs and POD.
CONFIGURATION
This Transformer is not configurable except for the standard options.
AUTHOR
Jeffrey Goff <drforr@pobox.com>
COPYRIGHT
Copyright (c) 2015 Jeffrey Goff
This program is free software; you can redistribute it and/or modify it under the same terms as Perl itself.