# substr. So skip this one.
[-BuiltinFunctions::ProhibitLvalueSubstr]
-# There are a few of these in Tidy.pm, Formatter.pm, Tokenizer.pm that
-# could be fixed. Then these lines could be removed.
-[-RegularExpressions::ProhibitUnusedCapture]
-[-RegularExpressions::ProhibitCaptureWithoutTest]
-
# There is one complex regex in Tokenizer.pm that should be simplified. Then
# this line can be removed.
[-RegularExpressions::ProhibitComplexRegexes]
# Since perltidy only encodes in utf8, problems can occur if we let it
# decode anything else. See discussions for issue git #83.
my $encoding = $rOpts->{'character-encoding'};
- if ( $encoding !~ /^\s*(guess|none|utf8|utf-8)\s*$/i ) {
+ if ( $encoding !~ /^\s*(?:guess|none|utf8|utf-8)\s*$/i ) {
Die(<<EOM);
--character-encoding = '$encoding' is not allowed; the options are: 'none', 'guess', 'utf8'
EOM
# Do not insert a blank after a comment
# (this could be subject to a flag in the future)
- if ( $code_type !~ /(BC|SBC|SBCX)/ ) {
+ if ( $code_type !~ /(?:BC|SBC|SBCX)/ ) {
if ( $rOpts_kgb_before == INSERT ) {
kgb_insert_blank_after( $ibeg - 1 );
$old_csc =~ s/\s+//g; # trim all whitespace
$new_csc =~ s/[\]\)\}\s]*$//; # trim trailing structures
$old_csc =~ s/[\]\)\}\s]*$//; # trim trailing structures
- $new_csc =~ s/(\.\.\.)$//; # trim trailing '...'
- my $new_trailing_dots = $1;
- $old_csc =~ s/(\.\.\.)\s*$//; # trim trailing '...'
+
+ # trim trailing '...'
+ my $new_trailing_dots = $new_csc =~ s/\.\.\.$//;
+ $old_csc =~ s/\.\.\.\s*$//;
# Patch to handle multiple closing side comments at
# else and elsif's. These have become too complicated
# NOTE: at present, braces in something like &{ xxx }
# are not marked as a block, we might have a method call.
# Added ')' to fix case c017, something like ()()()
- && $last_nonblank_token !~ /^([\]\}\)\&]|\-\>)/
+ && $last_nonblank_token !~ /^(?:[\]\}\)\&]|\-\>)/
)
{
# 'method' in older scripts.
if ( $tok_kw eq 'method' && $guess_if_method ) {
if ( $expecting == OPERATOR
- || $next_nonblank_token !~ /^(\w|\:)/
+ || $next_nonblank_token !~ /^[\w\:]/
|| !$self->method_ok_here() )
{
$self->do_UNKNOWN_BAREWORD($next_nonblank_token);
# package($x) - error
if ( $tok_kw eq 'class' ) {
if ( $expecting == OPERATOR
- || $next_nonblank_token !~ /^(\w|\:)/
+ || $next_nonblank_token !~ /^[\w\:]/
|| !$self->class_ok_here() )
{
$self->do_UNKNOWN_BAREWORD($next_nonblank_token);