Perl::...tachars(3pm)
okay bestie, welcome to Perl::...tachars(3pm) β a User Contributed Perl Documentation page, and yes the title is literally giving ellipsis realness π
β¨
πΈ NAME πΈ
Perl::Critic::Policy::ValuesAndExpressions::RequireInterpolationOfMetachars β the policy that warns you might have used single quotes when you really wanted double-quotes π«Ά
π«Ά AFFILIATION π«Ά
This policy is part of the core Perl::Critic distribution. She's not an add-on, she's main character energy π
β¨ DESCRIPTION β¨
This policy warns you if you use single-quotes or q// with a string that has unescaped metacharacters that may need interpolation. It's lowkey hard to know for sure if a string really should be interpolated without looking into the symbol table. So this policy just makes an educated guess by looking for metacharacters and sigils which usually indicate that the string should be interpolated. Cute, right? π§
π Exceptions
there are lil exceptions where she'll chill:
- Variable names to
use vars:
use vars '$x'; # ok
use vars ('$y', '$z'); # ok
use vars qw< $a $b >; # ok
- Things that look like e-mail addresses:
print 'john@foo.com'; # ok
$address = 'suzy.bar@baz.net'; # ok
π CONFIGURATION π
rcs_keywordsβ lets you stop this policy from complaining about things that look like RCS variables, for example, in deriving values for$VERSIONvariables. π
For example, if you've got code like
our ($VERSION) = (q<$Revision$> =~ m/(\d+)/mx);
You can specify
[ValuesAndExpressions::RequireInterpolationOfMetachars]
rcs_keywords = Revision
in your .perlcriticrc to provide an exemption. Slay, no more false alarm π
π NOTES π
Perl's own warnings pragma also warns you about this. So yeah, Perl is also looking out π
π SEE ALSO π
Perl::Critic::Policy::ValuesAndExpressions::ProhibitInterpolationOfLiterals
π AUTHOR π
Jeffrey Ryan Thalhammer <jeff@imaginative-software.com>
π COPYRIGHT π
Copyright (c) 2005-2023 Imaginative Software Systems.
This program is free software; you can redistribute it and/or modify it under the same terms as Perl itself. The full text of this license can be found in the LICENSE file included with this module.
mwah π β this page is perl v5.42.0, dated 2024-10-23, and that's the whole vibe π«Άβ¨
π¦ where this page comes from
- opensuse-leap 16.0: perl-Perl-Critic 1.156.0-bp160.1.1 Β· Artistic-1.0 OR GPL-1.0-or-later
- π girlified by deepseek-ai/DeepSeek-V4.1-Flash-1017 on : a language model's rewrite of the original, under its terms