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

NAME

Perl::Critic::Policy::RegularExpressions::ProhibitCaptureWithoutTest - Capture variable used outside conditional.

AFFILIATION

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

DESCRIPTION

If a regexp match fails, then any capture variables ($1, $2, ...) will be undefined. Therefore it's important to check the return value of a match before using those variables.

This policy checks that capture variables are inside a conditional and do not follow an regexps.

This policy does not check whether that conditional is actually testing a regexp result, nor does it check whether a regexp actually has a capture in it. Those checks are too hard.

CONFIGURATION

This Policy is not configurable except for the standard options.

AUTHOR

Chris Dolan <cdolan@cpan.org>

COPYRIGHT

Copyright (C) 2006 Chris Dolan. All rights reserved.

This program is free software; you can redistribute it and/or modify it under the same terms as Perl itself.