Marcelo Rodrigues > Perl-Critic-Itch-0.07 > Perl::Critic::Policy::CodeLayout::ProhibitHashBarewords

Download:
Perl-Critic-Itch-0.07.tar.gz

Dependencies

Annotate this POD

CPAN RT

New  1
Open  0
View/Report Bugs
Module Version: 0.07   Source  

NAME ^

Perl::Critic::Policy::CodeLayout::ProhibitHashBarewords

AFFILIATION ^

This policy is part of Perl::Critic::Itch.

VERSION ^

0.07

DESCRIPTION ^

This Policy forces (single) quotes on all hash keys barewords.

When specifying constant string hash keys, you should use (single) quotes. E.g., $my_hash{'some_key'}

This is the appropriate choice because it results in consistent formatting and if you forget to use quotes sometimes, you have to remember to add them when your key contains internal hyphens, spaces, or other special characters.

Quoted keys are also more likely to be syntax-highlighted by your editor.

INTERFACE ^

Standard for a Perl::Critic::Policy.

ACKNOWLEDGMENTS ^

Thanks to

syntax highlighting: