while (1) {
print <<EOM;
--------------------------------------------
-Perltidy Build Main Menu - Case Insensitive
--------------------------------------------
+----------------------------
+Main Menu - Case Insensitive
+----------------------------
dirs - working on directories: $dir_string
tidy - use perltidy version: $perltidy v$perltidy_version
my %input_hash = @_;
+ # This is the main perltidy routine
+
my %defaults = (
argv => undef,
destination => undef,
#----------------------------------------
# check parameters and their interactions
#----------------------------------------
- $self->check_options(
-
- $is_Windows,
- $Windows_type,
- $rpending_complaint,
- $num_files,
- $rinteger_option_range
-
- );
+ $self->check_options( $num_files, $rinteger_option_range );
if ($user_formatter) {
$rOpts->{'format'} = 'user';
# check iteration count and quietly fix if necessary:
# - iterations option only applies to code beautification mode
# - the convergence check should stop most runs on iteration 2, and
- # virtually all on iteration 3. But we'll allow up to 6.
+ # virtually all on iteration 3. We allow up to ITERATION_LIMIT.
$max_iterations = $rOpts->{'iterations'};
if ( !defined($max_iterations)
|| $max_iterations <= 0 )
sub line_diff {
+ my ( $s1, $s2 ) = @_;
+
# Given two strings, return
# $diff_marker = a string with carat (^) symbols indicating differences
# $pos1 = character position of first difference; pos1=-1 if no difference
# Form exclusive or of the strings, which has null characters where strings
# have same common characters so non-null characters indicate character
# differences.
- my ( $s1, $s2 ) = @_;
my $diff_marker = EMPTY_STRING;
my $pos = -1;
my $pos1 = $pos;
sub compare_string_buffers {
+ my ( $rbufi, $rbufo ) = @_;
+
# Compare input and output string buffers and return a brief text
# description of the first difference.
- my ( $rbufi, $rbufo ) = @_;
my $leni = defined($rbufi) ? length( ${$rbufi} ) : 0;
my $leno = defined($rbufo) ? length( ${$rbufo} ) : 0;
sub check_options {
- my (
- $self,
-
- $is_Windows,
- $Windows_type,
- $rpending_complaint,
- $num_files,
- $rinteger_option_range
+ my ( $self, $num_files, $rinteger_option_range ) = @_;
- ) = @_;
+ # Check options at a high level. Note that other modules have their
+ # own sub 'check_options' for lower level checking.
- # $num_files = number of files to be processed, for error checks
+ # Input parameters:
+ # $num_files = the number of files to be processed in this call to
+ # perltidy, needed for error checks.
+ # $rinteger_option-range = hash with valid ranges of parameters which
+ # take an integer
my $rOpts = $self->[_rOpts_];