The Perl Toolchain Summit needs more sponsors. If your company depends on Perl, please support this very important event.

NAME

Perl::Critic::Policy::Variables::ProhibitPunctuationVars - Write $EVAL_ERROR instead of $@.

AFFILIATION

This Policy is part of the core Perl::Critic distribution.

DESCRIPTION

Perl's vocabulary of punctuation variables such as $!, $., and $^ are perhaps the leading cause of its reputation as inscrutable line noise. The simple alternative is to use the English module to give them clear names.

  $| = undef;                      #not ok

  use English qw(-no_match_vars);
  local $OUTPUT_AUTOFLUSH = undef;        #ok

CONFIGURATION

The scratch variables $_ and @_ are very common and are pretty well understood, so they are exempt from this policy. The same goes for the less-frequently-used default filehandle _ used by stat(). All the regexp capture variables ($1, $2, ...) are exempt too.

You can add more exceptions to your configuration. In your perlcriticrc file, add a block like this:

  [Variables::ProhibitPunctuationVars]
  allow = $@ $!

The allow property should be a whitespace-delimited list of punctuation variables.

BUGS

This doesn't find punctuation variables in strings.

AUTHOR

Jeffrey Ryan Thalhammer <thaljef@cpan.org>

COPYRIGHT

Copyright (c) 2005-2008 Jeffrey Ryan Thalhammer. All rights reserved.

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.