# $self->weld_cuddled_blocks()
# }
-# The extra braces just add clutter.
-
+# The first form highlights the most important thing, a sub call,
+# and the conditional is just an optimization to skip it if not needed.
+# The second form buries the important thing in braces, making it harder
+# to see what is going on.
[-ControlStructures::ProhibitPostfixControls]
# Sometimes an unless statement is clearer than an if block, so why not use
# you have a comparison of the form $b->[*] <=> $a->[*]. So skip this.
[-BuiltinFunctions::ProhibitReverseSortBlock]
-# There are a few of these in perltidy that should be changed.
-[-RegularExpressions::RequireBracesForMultiline]
-
# There are too many of these in perltidy to change, and they seem fine.
[-RegularExpressions::ProhibitEscapedMetacharacters]
$base =~ s/;-?\d*$//
# remove explicit . version ie two dots in filename NB ^ escapes a dot
- or $base =~ s/( # begin capture $1
+ or $base =~ s{( # begin capture $1
(?:^|[^^])\. # match a dot not preceded by a caret
(?: # followed by nothing
| # or
)
) # end capture $1
\.-?\d*$ # match . version number
- /$1/x;
+ }{$1}x;
# normalize filename, if there are no unescaped dots then append one
$base .= '.' unless $base =~ /(?:^|[^^])\./;
# TEST 1: look a valid sub NAME
if (
- $input_line =~ m/\G\s*
+ $input_line =~ m{\G\s*
((?:\w*(?:'|::))*) # package - something that ends in :: or '
(\w+) # NAME - required
- /gcx
+ }gcx
)
{
# For possible future use..
# TEST 2: look for a valid NAME
if (
- $input_line =~ m/\G\s*
+ $input_line =~ m{\G\s*
((?:\w*(?:'|::))*) # package - something that ends in :: or '
(\w+) # NAME - required
- /gcx
+ }gcx
)
{
# For possible future use..
# Look for the sub NAME if this is a SUB call
if (
$call_type == SUB_CALL
- && $input_line =~ m/\G\s*
+ && $input_line =~ m{\G\s*
((?:\w*(?:'|::))*) # package - something that ends in :: or '
(\w+) # NAME - required
- /gcx
+ }gcx
)
{
$match = 1;
# $input_line =~ m/\G(\s*\([^\)\(\}\{\,#]*\))? # PROTO
my $saw_opening_paren = $input_line =~ /\G\s*\(/;
if (
- $input_line =~ m/\G(\s*\([^\)\(\}\{\,#A-Za-z]*\))? # PROTO
+ $input_line =~ m{\G(\s*\([^\)\(\}\{\,#A-Za-z]*\))? # PROTO
(\s*:)? # ATTRS leading ':'
- /gcx
+ }gcx
&& ( $1 || $2 )
)
{
# /\G[+-]?0(([xX][0-9a-fA-F_]+)|([0-7_]+)|([bB][01_]+))/g )
# (hex) (octal) (binary)
if (
- $input_line =~
+ $input_line =~ m{
- /\G[+-]?0( # leading [signed] 0
+ \G[+-]?0( # leading [signed] 0
# a hex float, i.e. '0x0.b17217f7d1cf78p0'
([xX][0-9a-fA-F_]* # X and optional leading digits
# or binary integer
|([bB][01_]+) # 'b' with string of binary digits
- )/gx
+ )}gx
)
{
$pos = pos($input_line);
while ( $max_tokens_wanted-- ) {
if (
- $str =~ /\G(
- (\s+) # type 'b' = whitespace - this must come before \W
- | (\W) # or type=char = single-character, non-whitespace punct
- | (\d+) # or type 'd' = sequence of digits - must come before \w
- | (\w+) # or type 'w' = words not starting with a digit
- )/gcx
+ $str =~ m{
+ \G(
+ (\s+) # type 'b' = whitespace - this must come before \W
+ | (\W) # or type=char = single-character, non-whitespace punct
+ | (\d+) # or type 'd' = sequence of digits - must come before \w
+ | (\w+) # or type 'w' = words not starting with a digit
+ )
+ }gcx
)
{
push @tokens, $1;