# see if ARGV is overridden
if ( defined($argv) ) {
- my $rargv = ref $argv;
+ my $rargv = ref($argv);
if ( $rargv eq 'SCALAR' ) { $argv = ${$argv}; $rargv = undef }
# ref to ARRAY
if ($in_place_modify) {
if ( $rOpts->{'standard-output'}
|| $destination_stream
- || ref $source_stream
+ || ref($source_stream)
|| $rOpts->{'outfile'}
|| defined( $rOpts->{'output-path'} ) )
{
# seen as 2 parameters, vtc and 1, so the abbreviations
# won't be seen. Therefore, we will catch them here if
# they get through.
- if ( defined $rOpts->{'vertical-tightness'} ) {
+ if ( defined( $rOpts->{'vertical-tightness'} ) ) {
my $vt = $rOpts->{'vertical-tightness'};
$rOpts->{'paren-vertical-tightness'} = $vt;
$rOpts->{'square-bracket-vertical-tightness'} = $vt;
$rOpts->{'brace-vertical-tightness'} = $vt;
}
- if ( defined $rOpts->{'vertical-tightness-closing'} ) {
+ if ( defined( $rOpts->{'vertical-tightness-closing'} ) ) {
my $vtc = $rOpts->{'vertical-tightness-closing'};
$rOpts->{'paren-vertical-tightness-closing'} = $vtc;
$rOpts->{'square-bracket-vertical-tightness-closing'} = $vtc;
$rOpts->{'brace-vertical-tightness-closing'} = $vtc;
}
- if ( defined $rOpts->{'closing-token-indentation'} ) {
+ if ( defined( $rOpts->{'closing-token-indentation'} ) ) {
my $cti = $rOpts->{'closing-token-indentation'};
$rOpts->{'closing-square-bracket-indentation'} = $cti;
$rOpts->{'closing-brace-indentation'} = $cti;
my $msg2;
foreach my $item (@items) {
my $item_save = $item;
- my $tok = chop($item);
+ my $tok = chop $item;
my $key = $token_keys{$tok};
if ( !defined($key) ) {
$msg1 .= " '$item_save'";
# remember the new K of this package; this may be
# off by 1 if a blank gets inserted before it
- push @{$rK_package_list}, scalar @{$rLL_new};
+ push @{$rK_package_list}, scalar( @{$rLL_new} );
}
elsif ( $type eq 'i' ) {
if ( $token eq '@_' && $current_sub_seqno ) {
# off by 1 if a blank gets inserted before it
push
@{ $rK_AT_underscore_by_sub_seqno->{$current_sub_seqno} },
- scalar @{$rLL_new};
+ scalar( @{$rLL_new} );
}
# Remember new K of the first '$self' in a sub for -dma option
if ( $token eq '$self' && $current_sub_seqno ) {
$rK_first_self_by_sub_seqno->{$current_sub_seqno} ||=
- scalar @{$rLL_new};
+ scalar( @{$rLL_new} );
}
# Remember new K and name of blessed objects for -dma option
)
{
push @{ $rK_bless_by_sub_seqno->{$current_sub_seqno} },
- [ scalar @{$rLL_new}, $token ];
+ [ scalar( @{$rLL_new} ), $token ];
}
}
elsif ( $type eq 'w' ) {
# off by 1 if a blank gets inserted before it
push
@{ $rK_return_by_sub_seqno->{$current_sub_seqno} },
- scalar @{$rLL_new};
+ scalar( @{$rLL_new} );
}
if ( $token eq 'wantarray' ) {
push
@{ $rK_wantarray_by_sub_seqno->{$current_sub_seqno} },
- scalar @{$rLL_new};
+ scalar( @{$rLL_new} );
}
}
return unless ($rOpts_kgb_inside);
# loop over sub-groups, index k
- push @subgroup, scalar @group;
+ push @subgroup, scalar(@group);
my $kbeg = 1;
my $kend = @subgroup - 1;
foreach my $k ( $kbeg .. $kend ) {
# How many spaces across the page will we fill?
my $columns_per_line =
- ( int $number_of_fields / 2 ) * $pair_width +
+ int( $number_of_fields / 2 ) * $pair_width +
( $number_of_fields % 2 ) * $max_width;
print {*STDOUT}
#------------------------------------------------------------------
# How many lines will this require?
- my $formatted_lines = $item_count / ($number_of_fields);
- if ( $formatted_lines != int $formatted_lines ) {
- $formatted_lines = 1 + int $formatted_lines;
+ my $formatted_lines = $item_count / $number_of_fields;
+ if ( $formatted_lines != int($formatted_lines) ) {
+ $formatted_lines = 1 + int($formatted_lines);
}
# So far we've been trying to fill out to the right margin. But
next unless ( $matching_char{$char} );
# pop most recently appended character
- my $top = chop($csc);
+ my $top = chop $csc;
# push it back plus the mate to the newest character
# unless they balance each other.
set_default_color( "html-color-$short_to_long_names{$short_name}", $color );
my $key;
$key = "html-bold-$short_to_long_names{$short_name}";
- $rOpts->{$key} = ( defined $rOpts->{$key} ) ? $rOpts->{$key} : $bold;
+ $rOpts->{$key} = defined( $rOpts->{$key} ) ? $rOpts->{$key} : $bold;
$key = "html-italic-$short_to_long_names{$short_name}";
- $rOpts->{$key} = ( defined $rOpts->{$key} ) ? $rOpts->{$key} : $italic;
+ $rOpts->{$key} = defined( $rOpts->{$key} ) ? $rOpts->{$key} : $italic;
return;
} ## end sub set_default_properties
# Must clean up if pod2html dies (it can);
# Be careful not to overwrite callers __DIE__ routine
local $SIG{__DIE__} = sub {
- unlink $tmpfile if -e $tmpfile;
+ unlink($tmpfile) if -e $tmpfile;
Perl::Tidy::Die( $_[0] );
};
# Intermingle code and pod sections if we saw multiple =cut's.
if ( $self->{_pod_cut_count} > 1 ) {
- my $rpre_string = shift( @{$rpre_string_stack} );
+ my $rpre_string = shift @{$rpre_string_stack};
if ( ${$rpre_string} ) {
$html_print->('<pre>');
$html_print->( ${$rpre_string} );
if ( $self->{_pod_cut_count} <= 1 ) {
$html_print->('<hr />');
}
- while ( my $rpre_string = shift( @{$rpre_string_stack} ) ) {
+ while ( my $rpre_string = shift @{$rpre_string_stack} ) {
$html_print->('<pre>');
$html_print->( ${$rpre_string} );
$html_print->('</pre>');
sub new {
my ( $package, $rscalar, $mode ) = @_;
- my $ref = ref $rscalar;
+ my $ref = ref($rscalar);
if ( $ref ne 'SCALAR' ) {
confess <<EOM;
------------------------------------------------------------------------
sub new {
my ( $package, $rarray, $mode ) = @_;
- my $ref = ref $rarray;
+ my $ref = ref($rarray);
if ( $ref ne 'ARRAY' ) {
confess <<EOM;
------------------------------------------------------------------------
# Find and remove what characters terminate this line, including any
# control r
my $input_line_separator = EMPTY_STRING;
- if ( chomp($input_line) ) {
+ if ( chomp $input_line ) {
$input_line_separator = $INPUT_RECORD_SEPARATOR;
}
$paren_depth = 0;
$brace_depth = 0;
$square_bracket_depth = 0;
- $rcurrent_depth = [ (0) x scalar @closing_brace_names ];
+ $rcurrent_depth = [ (0) x scalar(@closing_brace_names) ];
$total_depth = 0;
$rtotal_depth = [];
$rcurrent_sequence_number = [];
my $min = $sorted[0];
my $max = $sorted[-1];
- my $imid = int $num / 2;
+ my $imid = int( $num / 2 );
my $median =
@sorted % 2
? $sorted[$imid]
--closing-side-comments
--closing-side-comment-list='sub asub'
-# remove non-bare trailing commas (followed by paren)
+# remove non-bare trailing commas
# add trailing commas to key=>value hash lists
+# The + - notation requires version >= 20240903.03
--want-trailing-commas='-b +h'
--delete-trailing-commas
--add-trailing-commas
# For now, require arrows at asymmetric bracket combinations
--add-interbracket-arrows
--interbracket-arrow-style=']->{ }->['
+
+# use 'perltidy -dmcp filename' to find mixed call paren usage
+# prefer call parens for these keywords:
+--want-call-parens='open unlink substr defined ref scalar int'