# Code generated by Shell::POSIX::Select v0.09, by tim(AT)TeachMePerl.com # NOTA BENE: Line 1 of this segment must start with {, so user can LABEL it { # **** NEW WRAPPER SCOPE FOR SELECTLOOP #1 **** $Shell::POSIX::Select::DEBUG > 1 and 1 == 1 and warn "LINE NUMBER FOR START OF USER CODE_BLOCK IS: ", __LINE__, "\n"; _SEL_LOOP1: { # **** NEW SCOPE FOR SELECTLOOP #1 **** # critical for values's contents to be resolved in user's scope local @Shell::POSIX::Select::looplist=(@ARGV); local $Shell::POSIX::Select::num_values=@Shell::POSIX::Select::looplist; $Shell::POSIX::Select::DEBUG > 4 and do { warn "ARRAY VALUES ARE: @Shell::POSIX::Select::looplist\n"; warn "NUM VALUES is $Shell::POSIX::Select::num_values\n"; warn "user-program debug level is $Shell::POSIX::Select::U_WARN\n"; }; ; # NO DECLARATION OF LOOP-VAR REQUESTED # loop-var declaration appears here ; local ( $Shell::POSIX::Select::Prompt[1], $Shell::POSIX::Select::menu ) = Shell::POSIX::Select::make_menu( $Shell::POSIX::Select::Heading || "", $Shell::POSIX::Select::Prompt || "" , # Might be overridden in make_menu @Shell::POSIX::Select::looplist ); # no point in prompting a pipe! local $Shell::POSIX::Select::do_prompt[1] = (-t) ? 1 : 0 ; 0 > 2 and warn "do_prompt is $Shell::POSIX::Select::do_prompt[1]\n"; if ( defined $Shell::POSIX::Select::menu ) { # No list, no iterations! while (1) { # for repeating prompt for selections # localize, so I don't have to reset for # outer loop on exit from inner local ($Reply); while (1) { # for validating user's input local $Shell::POSIX::Select::bad = 0; # local decl suppresses newline on prompt when -l switch turned on { local $\; if ($Shell::POSIX::Select::do_prompt[1]) { # When transferring from INNER to OUTER loop, # extra NL before prompt is visually desirable if ( $Shell::POSIX::Select::_extra_nl) { print STDERR "\n\n"; $Shell::POSIX::Select::_extra_nl=0; } print STDERR "$Shell::POSIX::Select::menu\n$Shell::POSIX::Select::Prompt[1] "; } } # $Shell::POSIX::Select::do_prompt=0; # constant prompting depends on style $Shell::POSIX::Select::do_prompt[1]= 0; if ( $Shell::POSIX::Select::dump_data ) { $Reply = undef; # dump filtered source for comparison against expected print STDERR "copacetic "; # ensure some output, and flush pending exit 222; # code for graceful, expected, early exit } else { # $^W=0; # warn "Waiting for input"; $Eof=0; $Reply = ; # warn "Got input"; # $^W=1; if ( !defined( $Reply ) ) { defined "" and "" ne "" and print STDERR ""; # need to undef loop var; user may check it! undef $m; # last Shell::POSIX::Select::_SEL_LOOP1; # Syntax error! # If returning to outer loop, show the prompt for it # warn "User hit ^D"; if ( 1 > 1 and -t ) { # reset prompting for outer loop $Shell::POSIX::Select::do_prompt[1-1] = 1; $Shell::POSIX::Select::_extra_nl=1; } 0 > 2 and warn "Lasting out of _SEL_LOOP1\n"; $Eof=1; last _SEL_LOOP1; } !defined $Reply and die "REPLY accessed, while undefined"; chomp $Reply; # undo emboldening of user input defined "" and "" ne "" and print STDERR ""; #print STDERR "$Shell::POSIX::Select::menu\n$Shell::POSIX::Select::Prompt "; if ( $Reply eq "" ) { # interpreted as re-print menu request # Empty input is legit, means redisplay menu $Shell::POSIX::Select::U_WARN > 1 and warn "\tINPUT IS: empty\n"; $Shell::POSIX::Select::bad = $Shell::POSIX::Select::do_prompt[1] = 1; } elsif ( $Reply =~ /\D/ ) { # shouldn't be any non-digit! $Shell::POSIX::Select::U_WARN > 0 and warn "\tINPUT CONTAINS NON-DIGIT: '$Reply'\n"; $Shell::POSIX::Select::bad = 1; # Korn and Bash shell just ignore this case } elsif ( $Reply < 1 or $Reply > $Shell::POSIX::Select::num_values ) { $Shell::POSIX::Select::U_WARN > 0 and warn "\t'$Reply' IS NOT IN RANGE: 1 - $Shell::POSIX::Select::num_values\n"; $Shell::POSIX::Select::bad = 1; # Korn and Bash shell just ignore this case } # warn "BAD is now: $Shell::POSIX::Select::bad"; $Shell::POSIX::Select::bad or 0 > 2 and warn "About to last out of Reply Validator Loop "; $Shell::POSIX::Select::bad or last; # REPLY VALIDATOR EXITED HERE } # if for validating user input } # infinite while for validating user input $m = $Shell::POSIX::Select::looplist[$Reply - 1]; # set users' variable # USER'S LOOP-BLOCK BELOW print "$m\n";; # USER'S LOOP-BLOCK ABOVE # Making sure there's colon (maybe # even two) after codestring above, # in case user omitted after last # statement in block. I might add # another statement below it someday! 0 > 2 and warn "At end of prompt-repeating loop "; } # infinite while for repeating collection of selections 0 and warn "BEYOND end of prompt-repeating loop "; } # endif (defined $Shell::POSIX::Select::menu) else { $Shell::POSIX::Select::DEBUG > 0 and warn "Shell::POSIX::Select: Select Loop #1 has no list, so no iterations\n"; if ( $Shell::POSIX::Select::dump_data ) { $Reply = undef; # dump filtered source for comparison against expected print STDERR "copacetic "; # ensure some output, and flush pending exit 222; # code for graceful, expected, early exit } } # return omitted above, to get last expression's value # returned automatically, just like shell's version } # **** END NEW SCOPE FOR SELECTLOOP #1 **** } # **** END WRAPPER SCOPE FOR SELECTLOOP #1 **** # vi:ts=2 sw=2: # Code generated by Shell::POSIX::Select v0.09, by tim(AT)TeachMePerl.com # NOTA BENE: Line 1 of this segment must start with {, so user can LABEL it { # **** NEW WRAPPER SCOPE FOR SELECTLOOP #2 **** $Shell::POSIX::Select::DEBUG > 1 and 2 == 1 and warn "LINE NUMBER FOR START OF USER CODE_BLOCK IS: ", __LINE__, "\n"; _SEL_LOOP2: { # **** NEW SCOPE FOR SELECTLOOP #2 **** # critical for values's contents to be resolved in user's scope local @Shell::POSIX::Select::looplist=(@ARGV); local $Shell::POSIX::Select::num_values=@Shell::POSIX::Select::looplist; $Shell::POSIX::Select::DEBUG > 4 and do { warn "ARRAY VALUES ARE: @Shell::POSIX::Select::looplist\n"; warn "NUM VALUES is $Shell::POSIX::Select::num_values\n"; warn "user-program debug level is $Shell::POSIX::Select::U_WARN\n"; }; ; # NO DECLARATION OF LOOP-VAR REQUESTED # loop-var declaration appears here ; local ( $Shell::POSIX::Select::Prompt[2], $Shell::POSIX::Select::menu ) = Shell::POSIX::Select::make_menu( $Shell::POSIX::Select::Heading || "", $Shell::POSIX::Select::Prompt || "" , # Might be overridden in make_menu @Shell::POSIX::Select::looplist ); # no point in prompting a pipe! local $Shell::POSIX::Select::do_prompt[2] = (-t) ? 1 : 0 ; 0 > 2 and warn "do_prompt is $Shell::POSIX::Select::do_prompt[2]\n"; if ( defined $Shell::POSIX::Select::menu ) { # No list, no iterations! while (1) { # for repeating prompt for selections # localize, so I don't have to reset for # outer loop on exit from inner local ($Reply); while (1) { # for validating user's input local $Shell::POSIX::Select::bad = 0; # local decl suppresses newline on prompt when -l switch turned on { local $\; if ($Shell::POSIX::Select::do_prompt[2]) { # When transferring from INNER to OUTER loop, # extra NL before prompt is visually desirable if ( $Shell::POSIX::Select::_extra_nl) { print STDERR "\n\n"; $Shell::POSIX::Select::_extra_nl=0; } print STDERR "$Shell::POSIX::Select::menu\n$Shell::POSIX::Select::Prompt[2] "; } } # $Shell::POSIX::Select::do_prompt=0; # constant prompting depends on style $Shell::POSIX::Select::do_prompt[2]= 0; if ( $Shell::POSIX::Select::dump_data ) { $Reply = undef; # dump filtered source for comparison against expected print STDERR "copacetic "; # ensure some output, and flush pending exit 222; # code for graceful, expected, early exit } else { # $^W=0; # warn "Waiting for input"; $Eof=0; $Reply = ; # warn "Got input"; # $^W=1; if ( !defined( $Reply ) ) { defined "" and "" ne "" and print STDERR ""; # need to undef loop var; user may check it! undef $a; # last Shell::POSIX::Select::_SEL_LOOP2; # Syntax error! # If returning to outer loop, show the prompt for it # warn "User hit ^D"; if ( 2 > 1 and -t ) { # reset prompting for outer loop $Shell::POSIX::Select::do_prompt[2-1] = 1; $Shell::POSIX::Select::_extra_nl=1; } 0 > 2 and warn "Lasting out of _SEL_LOOP2\n"; $Eof=1; last _SEL_LOOP2; } !defined $Reply and die "REPLY accessed, while undefined"; chomp $Reply; # undo emboldening of user input defined "" and "" ne "" and print STDERR ""; #print STDERR "$Shell::POSIX::Select::menu\n$Shell::POSIX::Select::Prompt "; if ( $Reply eq "" ) { # interpreted as re-print menu request # Empty input is legit, means redisplay menu $Shell::POSIX::Select::U_WARN > 1 and warn "\tINPUT IS: empty\n"; $Shell::POSIX::Select::bad = $Shell::POSIX::Select::do_prompt[2] = 1; } elsif ( $Reply =~ /\D/ ) { # shouldn't be any non-digit! $Shell::POSIX::Select::U_WARN > 0 and warn "\tINPUT CONTAINS NON-DIGIT: '$Reply'\n"; $Shell::POSIX::Select::bad = 1; # Korn and Bash shell just ignore this case } elsif ( $Reply < 1 or $Reply > $Shell::POSIX::Select::num_values ) { $Shell::POSIX::Select::U_WARN > 0 and warn "\t'$Reply' IS NOT IN RANGE: 1 - $Shell::POSIX::Select::num_values\n"; $Shell::POSIX::Select::bad = 1; # Korn and Bash shell just ignore this case } # warn "BAD is now: $Shell::POSIX::Select::bad"; $Shell::POSIX::Select::bad or 0 > 2 and warn "About to last out of Reply Validator Loop "; $Shell::POSIX::Select::bad or last; # REPLY VALIDATOR EXITED HERE } # if for validating user input } # infinite while for validating user input $a = $Shell::POSIX::Select::looplist[$Reply - 1]; # set users' variable # USER'S LOOP-BLOCK BELOW print "$a\n";; # USER'S LOOP-BLOCK ABOVE # Making sure there's colon (maybe # even two) after codestring above, # in case user omitted after last # statement in block. I might add # another statement below it someday! 0 > 2 and warn "At end of prompt-repeating loop "; } # infinite while for repeating collection of selections 0 and warn "BEYOND end of prompt-repeating loop "; } # endif (defined $Shell::POSIX::Select::menu) else { $Shell::POSIX::Select::DEBUG > 0 and warn "Shell::POSIX::Select: Select Loop #2 has no list, so no iterations\n"; if ( $Shell::POSIX::Select::dump_data ) { $Reply = undef; # dump filtered source for comparison against expected print STDERR "copacetic "; # ensure some output, and flush pending exit 222; # code for graceful, expected, early exit } } # return omitted above, to get last expression's value # returned automatically, just like shell's version } # **** END NEW SCOPE FOR SELECTLOOP #2 **** } # **** END WRAPPER SCOPE FOR SELECTLOOP #2 **** # vi:ts=2 sw=2: # Code generated by Shell::POSIX::Select v0.09, by tim(AT)TeachMePerl.com # NOTA BENE: Line 1 of this segment must start with {, so user can LABEL it { # **** NEW WRAPPER SCOPE FOR SELECTLOOP #3 **** $Shell::POSIX::Select::DEBUG > 1 and 3 == 1 and warn "LINE NUMBER FOR START OF USER CODE_BLOCK IS: ", __LINE__, "\n"; _SEL_LOOP3: { # **** NEW SCOPE FOR SELECTLOOP #3 **** # critical for values's contents to be resolved in user's scope local @Shell::POSIX::Select::looplist=(@ARGV); local $Shell::POSIX::Select::num_values=@Shell::POSIX::Select::looplist; $Shell::POSIX::Select::DEBUG > 4 and do { warn "ARRAY VALUES ARE: @Shell::POSIX::Select::looplist\n"; warn "NUM VALUES is $Shell::POSIX::Select::num_values\n"; warn "user-program debug level is $Shell::POSIX::Select::U_WARN\n"; }; ; # NO DECLARATION OF LOOP-VAR REQUESTED # loop-var declaration appears here ; local ( $Shell::POSIX::Select::Prompt[3], $Shell::POSIX::Select::menu ) = Shell::POSIX::Select::make_menu( $Shell::POSIX::Select::Heading || "", $Shell::POSIX::Select::Prompt || "" , # Might be overridden in make_menu @Shell::POSIX::Select::looplist ); # no point in prompting a pipe! local $Shell::POSIX::Select::do_prompt[3] = (-t) ? 1 : 0 ; 0 > 2 and warn "do_prompt is $Shell::POSIX::Select::do_prompt[3]\n"; if ( defined $Shell::POSIX::Select::menu ) { # No list, no iterations! while (1) { # for repeating prompt for selections # localize, so I don't have to reset for # outer loop on exit from inner local ($Reply); while (1) { # for validating user's input local $Shell::POSIX::Select::bad = 0; # local decl suppresses newline on prompt when -l switch turned on { local $\; if ($Shell::POSIX::Select::do_prompt[3]) { # When transferring from INNER to OUTER loop, # extra NL before prompt is visually desirable if ( $Shell::POSIX::Select::_extra_nl) { print STDERR "\n\n"; $Shell::POSIX::Select::_extra_nl=0; } print STDERR "$Shell::POSIX::Select::menu\n$Shell::POSIX::Select::Prompt[3] "; } } # $Shell::POSIX::Select::do_prompt=0; # constant prompting depends on style $Shell::POSIX::Select::do_prompt[3]= 0; if ( $Shell::POSIX::Select::dump_data ) { $Reply = undef; # dump filtered source for comparison against expected print STDERR "copacetic "; # ensure some output, and flush pending exit 222; # code for graceful, expected, early exit } else { # $^W=0; # warn "Waiting for input"; $Eof=0; $Reply = ; # warn "Got input"; # $^W=1; if ( !defined( $Reply ) ) { defined "" and "" ne "" and print STDERR ""; # need to undef loop var; user may check it! undef $s; # last Shell::POSIX::Select::_SEL_LOOP3; # Syntax error! # If returning to outer loop, show the prompt for it # warn "User hit ^D"; if ( 3 > 1 and -t ) { # reset prompting for outer loop $Shell::POSIX::Select::do_prompt[3-1] = 1; $Shell::POSIX::Select::_extra_nl=1; } 0 > 2 and warn "Lasting out of _SEL_LOOP3\n"; $Eof=1; last _SEL_LOOP3; } !defined $Reply and die "REPLY accessed, while undefined"; chomp $Reply; # undo emboldening of user input defined "" and "" ne "" and print STDERR ""; #print STDERR "$Shell::POSIX::Select::menu\n$Shell::POSIX::Select::Prompt "; if ( $Reply eq "" ) { # interpreted as re-print menu request # Empty input is legit, means redisplay menu $Shell::POSIX::Select::U_WARN > 1 and warn "\tINPUT IS: empty\n"; $Shell::POSIX::Select::bad = $Shell::POSIX::Select::do_prompt[3] = 1; } elsif ( $Reply =~ /\D/ ) { # shouldn't be any non-digit! $Shell::POSIX::Select::U_WARN > 0 and warn "\tINPUT CONTAINS NON-DIGIT: '$Reply'\n"; $Shell::POSIX::Select::bad = 1; # Korn and Bash shell just ignore this case } elsif ( $Reply < 1 or $Reply > $Shell::POSIX::Select::num_values ) { $Shell::POSIX::Select::U_WARN > 0 and warn "\t'$Reply' IS NOT IN RANGE: 1 - $Shell::POSIX::Select::num_values\n"; $Shell::POSIX::Select::bad = 1; # Korn and Bash shell just ignore this case } # warn "BAD is now: $Shell::POSIX::Select::bad"; $Shell::POSIX::Select::bad or 0 > 2 and warn "About to last out of Reply Validator Loop "; $Shell::POSIX::Select::bad or last; # REPLY VALIDATOR EXITED HERE } # if for validating user input } # infinite while for validating user input $s = $Shell::POSIX::Select::looplist[$Reply - 1]; # set users' variable # USER'S LOOP-BLOCK BELOW print "$s\n";; # USER'S LOOP-BLOCK ABOVE # Making sure there's colon (maybe # even two) after codestring above, # in case user omitted after last # statement in block. I might add # another statement below it someday! 0 > 2 and warn "At end of prompt-repeating loop "; } # infinite while for repeating collection of selections 0 and warn "BEYOND end of prompt-repeating loop "; } # endif (defined $Shell::POSIX::Select::menu) else { $Shell::POSIX::Select::DEBUG > 0 and warn "Shell::POSIX::Select: Select Loop #3 has no list, so no iterations\n"; if ( $Shell::POSIX::Select::dump_data ) { $Reply = undef; # dump filtered source for comparison against expected print STDERR "copacetic "; # ensure some output, and flush pending exit 222; # code for graceful, expected, early exit } } # return omitted above, to get last expression's value # returned automatically, just like shell's version } # **** END NEW SCOPE FOR SELECTLOOP #3 **** } # **** END WRAPPER SCOPE FOR SELECTLOOP #3 **** # vi:ts=2 sw=2: # Code generated by Shell::POSIX::Select v0.09, by tim(AT)TeachMePerl.com # NOTA BENE: Line 1 of this segment must start with {, so user can LABEL it { # **** NEW WRAPPER SCOPE FOR SELECTLOOP #4 **** $Shell::POSIX::Select::DEBUG > 1 and 4 == 1 and warn "LINE NUMBER FOR START OF USER CODE_BLOCK IS: ", __LINE__, "\n"; _SEL_LOOP4: { # **** NEW SCOPE FOR SELECTLOOP #4 **** # critical for values's contents to be resolved in user's scope local @Shell::POSIX::Select::looplist=(@ARGV); local $Shell::POSIX::Select::num_values=@Shell::POSIX::Select::looplist; $Shell::POSIX::Select::DEBUG > 4 and do { warn "ARRAY VALUES ARE: @Shell::POSIX::Select::looplist\n"; warn "NUM VALUES is $Shell::POSIX::Select::num_values\n"; warn "user-program debug level is $Shell::POSIX::Select::U_WARN\n"; }; ; # NO DECLARATION OF LOOP-VAR REQUESTED # loop-var declaration appears here ; local ( $Shell::POSIX::Select::Prompt[4], $Shell::POSIX::Select::menu ) = Shell::POSIX::Select::make_menu( $Shell::POSIX::Select::Heading || "", $Shell::POSIX::Select::Prompt || "" , # Might be overridden in make_menu @Shell::POSIX::Select::looplist ); # no point in prompting a pipe! local $Shell::POSIX::Select::do_prompt[4] = (-t) ? 1 : 0 ; 0 > 2 and warn "do_prompt is $Shell::POSIX::Select::do_prompt[4]\n"; if ( defined $Shell::POSIX::Select::menu ) { # No list, no iterations! while (1) { # for repeating prompt for selections # localize, so I don't have to reset for # outer loop on exit from inner local ($Reply); while (1) { # for validating user's input local $Shell::POSIX::Select::bad = 0; # local decl suppresses newline on prompt when -l switch turned on { local $\; if ($Shell::POSIX::Select::do_prompt[4]) { # When transferring from INNER to OUTER loop, # extra NL before prompt is visually desirable if ( $Shell::POSIX::Select::_extra_nl) { print STDERR "\n\n"; $Shell::POSIX::Select::_extra_nl=0; } print STDERR "$Shell::POSIX::Select::menu\n$Shell::POSIX::Select::Prompt[4] "; } } # $Shell::POSIX::Select::do_prompt=0; # constant prompting depends on style $Shell::POSIX::Select::do_prompt[4]= 0; if ( $Shell::POSIX::Select::dump_data ) { $Reply = undef; # dump filtered source for comparison against expected print STDERR "copacetic "; # ensure some output, and flush pending exit 222; # code for graceful, expected, early exit } else { # $^W=0; # warn "Waiting for input"; $Eof=0; $Reply = ; # warn "Got input"; # $^W=1; if ( !defined( $Reply ) ) { defined "" and "" ne "" and print STDERR ""; # need to undef loop var; user may check it! undef $y; # last Shell::POSIX::Select::_SEL_LOOP4; # Syntax error! # If returning to outer loop, show the prompt for it # warn "User hit ^D"; if ( 4 > 1 and -t ) { # reset prompting for outer loop $Shell::POSIX::Select::do_prompt[4-1] = 1; $Shell::POSIX::Select::_extra_nl=1; } 0 > 2 and warn "Lasting out of _SEL_LOOP4\n"; $Eof=1; last _SEL_LOOP4; } !defined $Reply and die "REPLY accessed, while undefined"; chomp $Reply; # undo emboldening of user input defined "" and "" ne "" and print STDERR ""; #print STDERR "$Shell::POSIX::Select::menu\n$Shell::POSIX::Select::Prompt "; if ( $Reply eq "" ) { # interpreted as re-print menu request # Empty input is legit, means redisplay menu $Shell::POSIX::Select::U_WARN > 1 and warn "\tINPUT IS: empty\n"; $Shell::POSIX::Select::bad = $Shell::POSIX::Select::do_prompt[4] = 1; } elsif ( $Reply =~ /\D/ ) { # shouldn't be any non-digit! $Shell::POSIX::Select::U_WARN > 0 and warn "\tINPUT CONTAINS NON-DIGIT: '$Reply'\n"; $Shell::POSIX::Select::bad = 1; # Korn and Bash shell just ignore this case } elsif ( $Reply < 1 or $Reply > $Shell::POSIX::Select::num_values ) { $Shell::POSIX::Select::U_WARN > 0 and warn "\t'$Reply' IS NOT IN RANGE: 1 - $Shell::POSIX::Select::num_values\n"; $Shell::POSIX::Select::bad = 1; # Korn and Bash shell just ignore this case } # warn "BAD is now: $Shell::POSIX::Select::bad"; $Shell::POSIX::Select::bad or 0 > 2 and warn "About to last out of Reply Validator Loop "; $Shell::POSIX::Select::bad or last; # REPLY VALIDATOR EXITED HERE } # if for validating user input } # infinite while for validating user input $y = $Shell::POSIX::Select::looplist[$Reply - 1]; # set users' variable # USER'S LOOP-BLOCK BELOW print "$y\n";; # USER'S LOOP-BLOCK ABOVE # Making sure there's colon (maybe # even two) after codestring above, # in case user omitted after last # statement in block. I might add # another statement below it someday! 0 > 2 and warn "At end of prompt-repeating loop "; } # infinite while for repeating collection of selections 0 and warn "BEYOND end of prompt-repeating loop "; } # endif (defined $Shell::POSIX::Select::menu) else { $Shell::POSIX::Select::DEBUG > 0 and warn "Shell::POSIX::Select: Select Loop #4 has no list, so no iterations\n"; if ( $Shell::POSIX::Select::dump_data ) { $Reply = undef; # dump filtered source for comparison against expected print STDERR "copacetic "; # ensure some output, and flush pending exit 222; # code for graceful, expected, early exit } } # return omitted above, to get last expression's value # returned automatically, just like shell's version } # **** END NEW SCOPE FOR SELECTLOOP #4 **** } # **** END WRAPPER SCOPE FOR SELECTLOOP #4 **** # vi:ts=2 sw=2: # Code generated by Shell::POSIX::Select v0.09, by tim(AT)TeachMePerl.com # NOTA BENE: Line 1 of this segment must start with {, so user can LABEL it { # **** NEW WRAPPER SCOPE FOR SELECTLOOP #5 **** $Shell::POSIX::Select::DEBUG > 1 and 5 == 1 and warn "LINE NUMBER FOR START OF USER CODE_BLOCK IS: ", __LINE__, "\n"; _SEL_LOOP5: { # **** NEW SCOPE FOR SELECTLOOP #5 **** # critical for values's contents to be resolved in user's scope local @Shell::POSIX::Select::looplist=(@ARGV); local $Shell::POSIX::Select::num_values=@Shell::POSIX::Select::looplist; $Shell::POSIX::Select::DEBUG > 4 and do { warn "ARRAY VALUES ARE: @Shell::POSIX::Select::looplist\n"; warn "NUM VALUES is $Shell::POSIX::Select::num_values\n"; warn "user-program debug level is $Shell::POSIX::Select::U_WARN\n"; }; ; # NO DECLARATION OF LOOP-VAR REQUESTED # loop-var declaration appears here ; local ( $Shell::POSIX::Select::Prompt[5], $Shell::POSIX::Select::menu ) = Shell::POSIX::Select::make_menu( $Shell::POSIX::Select::Heading || "", $Shell::POSIX::Select::Prompt || "" , # Might be overridden in make_menu @Shell::POSIX::Select::looplist ); # no point in prompting a pipe! local $Shell::POSIX::Select::do_prompt[5] = (-t) ? 1 : 0 ; 0 > 2 and warn "do_prompt is $Shell::POSIX::Select::do_prompt[5]\n"; if ( defined $Shell::POSIX::Select::menu ) { # No list, no iterations! while (1) { # for repeating prompt for selections # localize, so I don't have to reset for # outer loop on exit from inner local ($Reply); while (1) { # for validating user's input local $Shell::POSIX::Select::bad = 0; # local decl suppresses newline on prompt when -l switch turned on { local $\; if ($Shell::POSIX::Select::do_prompt[5]) { # When transferring from INNER to OUTER loop, # extra NL before prompt is visually desirable if ( $Shell::POSIX::Select::_extra_nl) { print STDERR "\n\n"; $Shell::POSIX::Select::_extra_nl=0; } print STDERR "$Shell::POSIX::Select::menu\n$Shell::POSIX::Select::Prompt[5] "; } } # $Shell::POSIX::Select::do_prompt=0; # constant prompting depends on style $Shell::POSIX::Select::do_prompt[5]= 0; if ( $Shell::POSIX::Select::dump_data ) { $Reply = undef; # dump filtered source for comparison against expected print STDERR "copacetic "; # ensure some output, and flush pending exit 222; # code for graceful, expected, early exit } else { # $^W=0; # warn "Waiting for input"; $Eof=0; $Reply = ; # warn "Got input"; # $^W=1; if ( !defined( $Reply ) ) { defined "" and "" ne "" and print STDERR ""; # need to undef loop var; user may check it! undef $tr; # last Shell::POSIX::Select::_SEL_LOOP5; # Syntax error! # If returning to outer loop, show the prompt for it # warn "User hit ^D"; if ( 5 > 1 and -t ) { # reset prompting for outer loop $Shell::POSIX::Select::do_prompt[5-1] = 1; $Shell::POSIX::Select::_extra_nl=1; } 0 > 2 and warn "Lasting out of _SEL_LOOP5\n"; $Eof=1; last _SEL_LOOP5; } !defined $Reply and die "REPLY accessed, while undefined"; chomp $Reply; # undo emboldening of user input defined "" and "" ne "" and print STDERR ""; #print STDERR "$Shell::POSIX::Select::menu\n$Shell::POSIX::Select::Prompt "; if ( $Reply eq "" ) { # interpreted as re-print menu request # Empty input is legit, means redisplay menu $Shell::POSIX::Select::U_WARN > 1 and warn "\tINPUT IS: empty\n"; $Shell::POSIX::Select::bad = $Shell::POSIX::Select::do_prompt[5] = 1; } elsif ( $Reply =~ /\D/ ) { # shouldn't be any non-digit! $Shell::POSIX::Select::U_WARN > 0 and warn "\tINPUT CONTAINS NON-DIGIT: '$Reply'\n"; $Shell::POSIX::Select::bad = 1; # Korn and Bash shell just ignore this case } elsif ( $Reply < 1 or $Reply > $Shell::POSIX::Select::num_values ) { $Shell::POSIX::Select::U_WARN > 0 and warn "\t'$Reply' IS NOT IN RANGE: 1 - $Shell::POSIX::Select::num_values\n"; $Shell::POSIX::Select::bad = 1; # Korn and Bash shell just ignore this case } # warn "BAD is now: $Shell::POSIX::Select::bad"; $Shell::POSIX::Select::bad or 0 > 2 and warn "About to last out of Reply Validator Loop "; $Shell::POSIX::Select::bad or last; # REPLY VALIDATOR EXITED HERE } # if for validating user input } # infinite while for validating user input $tr = $Shell::POSIX::Select::looplist[$Reply - 1]; # set users' variable # USER'S LOOP-BLOCK BELOW print "$tr\n";; # USER'S LOOP-BLOCK ABOVE # Making sure there's colon (maybe # even two) after codestring above, # in case user omitted after last # statement in block. I might add # another statement below it someday! 0 > 2 and warn "At end of prompt-repeating loop "; } # infinite while for repeating collection of selections 0 and warn "BEYOND end of prompt-repeating loop "; } # endif (defined $Shell::POSIX::Select::menu) else { $Shell::POSIX::Select::DEBUG > 0 and warn "Shell::POSIX::Select: Select Loop #5 has no list, so no iterations\n"; if ( $Shell::POSIX::Select::dump_data ) { $Reply = undef; # dump filtered source for comparison against expected print STDERR "copacetic "; # ensure some output, and flush pending exit 222; # code for graceful, expected, early exit } } # return omitted above, to get last expression's value # returned automatically, just like shell's version } # **** END NEW SCOPE FOR SELECTLOOP #5 **** } # **** END WRAPPER SCOPE FOR SELECTLOOP #5 **** # vi:ts=2 sw=2: # Code generated by Shell::POSIX::Select v0.09, by tim(AT)TeachMePerl.com # NOTA BENE: Line 1 of this segment must start with {, so user can LABEL it { # **** NEW WRAPPER SCOPE FOR SELECTLOOP #6 **** $Shell::POSIX::Select::DEBUG > 1 and 6 == 1 and warn "LINE NUMBER FOR START OF USER CODE_BLOCK IS: ", __LINE__, "\n"; _SEL_LOOP6: { # **** NEW SCOPE FOR SELECTLOOP #6 **** # critical for values's contents to be resolved in user's scope local @Shell::POSIX::Select::looplist=(@ARGV); local $Shell::POSIX::Select::num_values=@Shell::POSIX::Select::looplist; $Shell::POSIX::Select::DEBUG > 4 and do { warn "ARRAY VALUES ARE: @Shell::POSIX::Select::looplist\n"; warn "NUM VALUES is $Shell::POSIX::Select::num_values\n"; warn "user-program debug level is $Shell::POSIX::Select::U_WARN\n"; }; ; # NO DECLARATION OF LOOP-VAR REQUESTED # loop-var declaration appears here ; local ( $Shell::POSIX::Select::Prompt[6], $Shell::POSIX::Select::menu ) = Shell::POSIX::Select::make_menu( $Shell::POSIX::Select::Heading || "", $Shell::POSIX::Select::Prompt || "" , # Might be overridden in make_menu @Shell::POSIX::Select::looplist ); # no point in prompting a pipe! local $Shell::POSIX::Select::do_prompt[6] = (-t) ? 1 : 0 ; 0 > 2 and warn "do_prompt is $Shell::POSIX::Select::do_prompt[6]\n"; if ( defined $Shell::POSIX::Select::menu ) { # No list, no iterations! while (1) { # for repeating prompt for selections # localize, so I don't have to reset for # outer loop on exit from inner local ($Reply); while (1) { # for validating user's input local $Shell::POSIX::Select::bad = 0; # local decl suppresses newline on prompt when -l switch turned on { local $\; if ($Shell::POSIX::Select::do_prompt[6]) { # When transferring from INNER to OUTER loop, # extra NL before prompt is visually desirable if ( $Shell::POSIX::Select::_extra_nl) { print STDERR "\n\n"; $Shell::POSIX::Select::_extra_nl=0; } print STDERR "$Shell::POSIX::Select::menu\n$Shell::POSIX::Select::Prompt[6] "; } } # $Shell::POSIX::Select::do_prompt=0; # constant prompting depends on style $Shell::POSIX::Select::do_prompt[6]= 0; if ( $Shell::POSIX::Select::dump_data ) { $Reply = undef; # dump filtered source for comparison against expected print STDERR "copacetic "; # ensure some output, and flush pending exit 222; # code for graceful, expected, early exit } else { # $^W=0; # warn "Waiting for input"; $Eof=0; $Reply = ; # warn "Got input"; # $^W=1; if ( !defined( $Reply ) ) { defined "" and "" ne "" and print STDERR ""; # need to undef loop var; user may check it! undef $qq; # last Shell::POSIX::Select::_SEL_LOOP6; # Syntax error! # If returning to outer loop, show the prompt for it # warn "User hit ^D"; if ( 6 > 1 and -t ) { # reset prompting for outer loop $Shell::POSIX::Select::do_prompt[6-1] = 1; $Shell::POSIX::Select::_extra_nl=1; } 0 > 2 and warn "Lasting out of _SEL_LOOP6\n"; $Eof=1; last _SEL_LOOP6; } !defined $Reply and die "REPLY accessed, while undefined"; chomp $Reply; # undo emboldening of user input defined "" and "" ne "" and print STDERR ""; #print STDERR "$Shell::POSIX::Select::menu\n$Shell::POSIX::Select::Prompt "; if ( $Reply eq "" ) { # interpreted as re-print menu request # Empty input is legit, means redisplay menu $Shell::POSIX::Select::U_WARN > 1 and warn "\tINPUT IS: empty\n"; $Shell::POSIX::Select::bad = $Shell::POSIX::Select::do_prompt[6] = 1; } elsif ( $Reply =~ /\D/ ) { # shouldn't be any non-digit! $Shell::POSIX::Select::U_WARN > 0 and warn "\tINPUT CONTAINS NON-DIGIT: '$Reply'\n"; $Shell::POSIX::Select::bad = 1; # Korn and Bash shell just ignore this case } elsif ( $Reply < 1 or $Reply > $Shell::POSIX::Select::num_values ) { $Shell::POSIX::Select::U_WARN > 0 and warn "\t'$Reply' IS NOT IN RANGE: 1 - $Shell::POSIX::Select::num_values\n"; $Shell::POSIX::Select::bad = 1; # Korn and Bash shell just ignore this case } # warn "BAD is now: $Shell::POSIX::Select::bad"; $Shell::POSIX::Select::bad or 0 > 2 and warn "About to last out of Reply Validator Loop "; $Shell::POSIX::Select::bad or last; # REPLY VALIDATOR EXITED HERE } # if for validating user input } # infinite while for validating user input $qq = $Shell::POSIX::Select::looplist[$Reply - 1]; # set users' variable # USER'S LOOP-BLOCK BELOW print "$qq\n";; # USER'S LOOP-BLOCK ABOVE # Making sure there's colon (maybe # even two) after codestring above, # in case user omitted after last # statement in block. I might add # another statement below it someday! 0 > 2 and warn "At end of prompt-repeating loop "; } # infinite while for repeating collection of selections 0 and warn "BEYOND end of prompt-repeating loop "; } # endif (defined $Shell::POSIX::Select::menu) else { $Shell::POSIX::Select::DEBUG > 0 and warn "Shell::POSIX::Select: Select Loop #6 has no list, so no iterations\n"; if ( $Shell::POSIX::Select::dump_data ) { $Reply = undef; # dump filtered source for comparison against expected print STDERR "copacetic "; # ensure some output, and flush pending exit 222; # code for graceful, expected, early exit } } # return omitted above, to get last expression's value # returned automatically, just like shell's version } # **** END NEW SCOPE FOR SELECTLOOP #6 **** } # **** END WRAPPER SCOPE FOR SELECTLOOP #6 **** # vi:ts=2 sw=2: # Code generated by Shell::POSIX::Select v0.09, by tim(AT)TeachMePerl.com # NOTA BENE: Line 1 of this segment must start with {, so user can LABEL it { # **** NEW WRAPPER SCOPE FOR SELECTLOOP #7 **** $Shell::POSIX::Select::DEBUG > 1 and 7 == 1 and warn "LINE NUMBER FOR START OF USER CODE_BLOCK IS: ", __LINE__, "\n"; _SEL_LOOP7: { # **** NEW SCOPE FOR SELECTLOOP #7 **** # critical for values's contents to be resolved in user's scope local @Shell::POSIX::Select::looplist=(@ARGV); local $Shell::POSIX::Select::num_values=@Shell::POSIX::Select::looplist; $Shell::POSIX::Select::DEBUG > 4 and do { warn "ARRAY VALUES ARE: @Shell::POSIX::Select::looplist\n"; warn "NUM VALUES is $Shell::POSIX::Select::num_values\n"; warn "user-program debug level is $Shell::POSIX::Select::U_WARN\n"; }; ; # NO DECLARATION OF LOOP-VAR REQUESTED # loop-var declaration appears here ; local ( $Shell::POSIX::Select::Prompt[7], $Shell::POSIX::Select::menu ) = Shell::POSIX::Select::make_menu( $Shell::POSIX::Select::Heading || "", $Shell::POSIX::Select::Prompt || "" , # Might be overridden in make_menu @Shell::POSIX::Select::looplist ); # no point in prompting a pipe! local $Shell::POSIX::Select::do_prompt[7] = (-t) ? 1 : 0 ; 0 > 2 and warn "do_prompt is $Shell::POSIX::Select::do_prompt[7]\n"; if ( defined $Shell::POSIX::Select::menu ) { # No list, no iterations! while (1) { # for repeating prompt for selections # localize, so I don't have to reset for # outer loop on exit from inner local ($Reply); while (1) { # for validating user's input local $Shell::POSIX::Select::bad = 0; # local decl suppresses newline on prompt when -l switch turned on { local $\; if ($Shell::POSIX::Select::do_prompt[7]) { # When transferring from INNER to OUTER loop, # extra NL before prompt is visually desirable if ( $Shell::POSIX::Select::_extra_nl) { print STDERR "\n\n"; $Shell::POSIX::Select::_extra_nl=0; } print STDERR "$Shell::POSIX::Select::menu\n$Shell::POSIX::Select::Prompt[7] "; } } # $Shell::POSIX::Select::do_prompt=0; # constant prompting depends on style $Shell::POSIX::Select::do_prompt[7]= 0; if ( $Shell::POSIX::Select::dump_data ) { $Reply = undef; # dump filtered source for comparison against expected print STDERR "copacetic "; # ensure some output, and flush pending exit 222; # code for graceful, expected, early exit } else { # $^W=0; # warn "Waiting for input"; $Eof=0; $Reply = ; # warn "Got input"; # $^W=1; if ( !defined( $Reply ) ) { defined "" and "" ne "" and print STDERR ""; # need to undef loop var; user may check it! undef $qw; # last Shell::POSIX::Select::_SEL_LOOP7; # Syntax error! # If returning to outer loop, show the prompt for it # warn "User hit ^D"; if ( 7 > 1 and -t ) { # reset prompting for outer loop $Shell::POSIX::Select::do_prompt[7-1] = 1; $Shell::POSIX::Select::_extra_nl=1; } 0 > 2 and warn "Lasting out of _SEL_LOOP7\n"; $Eof=1; last _SEL_LOOP7; } !defined $Reply and die "REPLY accessed, while undefined"; chomp $Reply; # undo emboldening of user input defined "" and "" ne "" and print STDERR ""; #print STDERR "$Shell::POSIX::Select::menu\n$Shell::POSIX::Select::Prompt "; if ( $Reply eq "" ) { # interpreted as re-print menu request # Empty input is legit, means redisplay menu $Shell::POSIX::Select::U_WARN > 1 and warn "\tINPUT IS: empty\n"; $Shell::POSIX::Select::bad = $Shell::POSIX::Select::do_prompt[7] = 1; } elsif ( $Reply =~ /\D/ ) { # shouldn't be any non-digit! $Shell::POSIX::Select::U_WARN > 0 and warn "\tINPUT CONTAINS NON-DIGIT: '$Reply'\n"; $Shell::POSIX::Select::bad = 1; # Korn and Bash shell just ignore this case } elsif ( $Reply < 1 or $Reply > $Shell::POSIX::Select::num_values ) { $Shell::POSIX::Select::U_WARN > 0 and warn "\t'$Reply' IS NOT IN RANGE: 1 - $Shell::POSIX::Select::num_values\n"; $Shell::POSIX::Select::bad = 1; # Korn and Bash shell just ignore this case } # warn "BAD is now: $Shell::POSIX::Select::bad"; $Shell::POSIX::Select::bad or 0 > 2 and warn "About to last out of Reply Validator Loop "; $Shell::POSIX::Select::bad or last; # REPLY VALIDATOR EXITED HERE } # if for validating user input } # infinite while for validating user input $qw = $Shell::POSIX::Select::looplist[$Reply - 1]; # set users' variable # USER'S LOOP-BLOCK BELOW print "$qw\n";; # USER'S LOOP-BLOCK ABOVE # Making sure there's colon (maybe # even two) after codestring above, # in case user omitted after last # statement in block. I might add # another statement below it someday! 0 > 2 and warn "At end of prompt-repeating loop "; } # infinite while for repeating collection of selections 0 and warn "BEYOND end of prompt-repeating loop "; } # endif (defined $Shell::POSIX::Select::menu) else { $Shell::POSIX::Select::DEBUG > 0 and warn "Shell::POSIX::Select: Select Loop #7 has no list, so no iterations\n"; if ( $Shell::POSIX::Select::dump_data ) { $Reply = undef; # dump filtered source for comparison against expected print STDERR "copacetic "; # ensure some output, and flush pending exit 222; # code for graceful, expected, early exit } } # return omitted above, to get last expression's value # returned automatically, just like shell's version } # **** END NEW SCOPE FOR SELECTLOOP #7 **** } # **** END WRAPPER SCOPE FOR SELECTLOOP #7 **** # vi:ts=2 sw=2: # Code generated by Shell::POSIX::Select v0.09, by tim(AT)TeachMePerl.com # NOTA BENE: Line 1 of this segment must start with {, so user can LABEL it { # **** NEW WRAPPER SCOPE FOR SELECTLOOP #8 **** $Shell::POSIX::Select::DEBUG > 1 and 8 == 1 and warn "LINE NUMBER FOR START OF USER CODE_BLOCK IS: ", __LINE__, "\n"; _SEL_LOOP8: { # **** NEW SCOPE FOR SELECTLOOP #8 **** # critical for values's contents to be resolved in user's scope local @Shell::POSIX::Select::looplist=(@ARGV); local $Shell::POSIX::Select::num_values=@Shell::POSIX::Select::looplist; $Shell::POSIX::Select::DEBUG > 4 and do { warn "ARRAY VALUES ARE: @Shell::POSIX::Select::looplist\n"; warn "NUM VALUES is $Shell::POSIX::Select::num_values\n"; warn "user-program debug level is $Shell::POSIX::Select::U_WARN\n"; }; ; # NO DECLARATION OF LOOP-VAR REQUESTED # loop-var declaration appears here ; local ( $Shell::POSIX::Select::Prompt[8], $Shell::POSIX::Select::menu ) = Shell::POSIX::Select::make_menu( $Shell::POSIX::Select::Heading || "", $Shell::POSIX::Select::Prompt || "" , # Might be overridden in make_menu @Shell::POSIX::Select::looplist ); # no point in prompting a pipe! local $Shell::POSIX::Select::do_prompt[8] = (-t) ? 1 : 0 ; 0 > 2 and warn "do_prompt is $Shell::POSIX::Select::do_prompt[8]\n"; if ( defined $Shell::POSIX::Select::menu ) { # No list, no iterations! while (1) { # for repeating prompt for selections # localize, so I don't have to reset for # outer loop on exit from inner local ($Reply); while (1) { # for validating user's input local $Shell::POSIX::Select::bad = 0; # local decl suppresses newline on prompt when -l switch turned on { local $\; if ($Shell::POSIX::Select::do_prompt[8]) { # When transferring from INNER to OUTER loop, # extra NL before prompt is visually desirable if ( $Shell::POSIX::Select::_extra_nl) { print STDERR "\n\n"; $Shell::POSIX::Select::_extra_nl=0; } print STDERR "$Shell::POSIX::Select::menu\n$Shell::POSIX::Select::Prompt[8] "; } } # $Shell::POSIX::Select::do_prompt=0; # constant prompting depends on style $Shell::POSIX::Select::do_prompt[8]= 0; if ( $Shell::POSIX::Select::dump_data ) { $Reply = undef; # dump filtered source for comparison against expected print STDERR "copacetic "; # ensure some output, and flush pending exit 222; # code for graceful, expected, early exit } else { # $^W=0; # warn "Waiting for input"; $Eof=0; $Reply = ; # warn "Got input"; # $^W=1; if ( !defined( $Reply ) ) { defined "" and "" ne "" and print STDERR ""; # need to undef loop var; user may check it! undef $qr; # last Shell::POSIX::Select::_SEL_LOOP8; # Syntax error! # If returning to outer loop, show the prompt for it # warn "User hit ^D"; if ( 8 > 1 and -t ) { # reset prompting for outer loop $Shell::POSIX::Select::do_prompt[8-1] = 1; $Shell::POSIX::Select::_extra_nl=1; } 0 > 2 and warn "Lasting out of _SEL_LOOP8\n"; $Eof=1; last _SEL_LOOP8; } !defined $Reply and die "REPLY accessed, while undefined"; chomp $Reply; # undo emboldening of user input defined "" and "" ne "" and print STDERR ""; #print STDERR "$Shell::POSIX::Select::menu\n$Shell::POSIX::Select::Prompt "; if ( $Reply eq "" ) { # interpreted as re-print menu request # Empty input is legit, means redisplay menu $Shell::POSIX::Select::U_WARN > 1 and warn "\tINPUT IS: empty\n"; $Shell::POSIX::Select::bad = $Shell::POSIX::Select::do_prompt[8] = 1; } elsif ( $Reply =~ /\D/ ) { # shouldn't be any non-digit! $Shell::POSIX::Select::U_WARN > 0 and warn "\tINPUT CONTAINS NON-DIGIT: '$Reply'\n"; $Shell::POSIX::Select::bad = 1; # Korn and Bash shell just ignore this case } elsif ( $Reply < 1 or $Reply > $Shell::POSIX::Select::num_values ) { $Shell::POSIX::Select::U_WARN > 0 and warn "\t'$Reply' IS NOT IN RANGE: 1 - $Shell::POSIX::Select::num_values\n"; $Shell::POSIX::Select::bad = 1; # Korn and Bash shell just ignore this case } # warn "BAD is now: $Shell::POSIX::Select::bad"; $Shell::POSIX::Select::bad or 0 > 2 and warn "About to last out of Reply Validator Loop "; $Shell::POSIX::Select::bad or last; # REPLY VALIDATOR EXITED HERE } # if for validating user input } # infinite while for validating user input $qr = $Shell::POSIX::Select::looplist[$Reply - 1]; # set users' variable # USER'S LOOP-BLOCK BELOW print "$qr\n";; # USER'S LOOP-BLOCK ABOVE # Making sure there's colon (maybe # even two) after codestring above, # in case user omitted after last # statement in block. I might add # another statement below it someday! 0 > 2 and warn "At end of prompt-repeating loop "; } # infinite while for repeating collection of selections 0 and warn "BEYOND end of prompt-repeating loop "; } # endif (defined $Shell::POSIX::Select::menu) else { $Shell::POSIX::Select::DEBUG > 0 and warn "Shell::POSIX::Select: Select Loop #8 has no list, so no iterations\n"; if ( $Shell::POSIX::Select::dump_data ) { $Reply = undef; # dump filtered source for comparison against expected print STDERR "copacetic "; # ensure some output, and flush pending exit 222; # code for graceful, expected, early exit } } # return omitted above, to get last expression's value # returned automatically, just like shell's version } # **** END NEW SCOPE FOR SELECTLOOP #8 **** } # **** END WRAPPER SCOPE FOR SELECTLOOP #8 **** # vi:ts=2 sw=2: # Code generated by Shell::POSIX::Select v0.09, by tim(AT)TeachMePerl.com # NOTA BENE: Line 1 of this segment must start with {, so user can LABEL it { # **** NEW WRAPPER SCOPE FOR SELECTLOOP #9 **** $Shell::POSIX::Select::DEBUG > 1 and 9 == 1 and warn "LINE NUMBER FOR START OF USER CODE_BLOCK IS: ", __LINE__, "\n"; _SEL_LOOP9: { # **** NEW SCOPE FOR SELECTLOOP #9 **** # critical for values's contents to be resolved in user's scope local @Shell::POSIX::Select::looplist=(@ARGV); local $Shell::POSIX::Select::num_values=@Shell::POSIX::Select::looplist; $Shell::POSIX::Select::DEBUG > 4 and do { warn "ARRAY VALUES ARE: @Shell::POSIX::Select::looplist\n"; warn "NUM VALUES is $Shell::POSIX::Select::num_values\n"; warn "user-program debug level is $Shell::POSIX::Select::U_WARN\n"; }; ; # NO DECLARATION OF LOOP-VAR REQUESTED # loop-var declaration appears here ; local ( $Shell::POSIX::Select::Prompt[9], $Shell::POSIX::Select::menu ) = Shell::POSIX::Select::make_menu( $Shell::POSIX::Select::Heading || "", $Shell::POSIX::Select::Prompt || "" , # Might be overridden in make_menu @Shell::POSIX::Select::looplist ); # no point in prompting a pipe! local $Shell::POSIX::Select::do_prompt[9] = (-t) ? 1 : 0 ; 0 > 2 and warn "do_prompt is $Shell::POSIX::Select::do_prompt[9]\n"; if ( defined $Shell::POSIX::Select::menu ) { # No list, no iterations! while (1) { # for repeating prompt for selections # localize, so I don't have to reset for # outer loop on exit from inner local ($Reply); while (1) { # for validating user's input local $Shell::POSIX::Select::bad = 0; # local decl suppresses newline on prompt when -l switch turned on { local $\; if ($Shell::POSIX::Select::do_prompt[9]) { # When transferring from INNER to OUTER loop, # extra NL before prompt is visually desirable if ( $Shell::POSIX::Select::_extra_nl) { print STDERR "\n\n"; $Shell::POSIX::Select::_extra_nl=0; } print STDERR "$Shell::POSIX::Select::menu\n$Shell::POSIX::Select::Prompt[9] "; } } # $Shell::POSIX::Select::do_prompt=0; # constant prompting depends on style $Shell::POSIX::Select::do_prompt[9]= 0; if ( $Shell::POSIX::Select::dump_data ) { $Reply = undef; # dump filtered source for comparison against expected print STDERR "copacetic "; # ensure some output, and flush pending exit 222; # code for graceful, expected, early exit } else { # $^W=0; # warn "Waiting for input"; $Eof=0; $Reply = ; # warn "Got input"; # $^W=1; if ( !defined( $Reply ) ) { defined "" and "" ne "" and print STDERR ""; # need to undef loop var; user may check it! undef $qx; # last Shell::POSIX::Select::_SEL_LOOP9; # Syntax error! # If returning to outer loop, show the prompt for it # warn "User hit ^D"; if ( 9 > 1 and -t ) { # reset prompting for outer loop $Shell::POSIX::Select::do_prompt[9-1] = 1; $Shell::POSIX::Select::_extra_nl=1; } 0 > 2 and warn "Lasting out of _SEL_LOOP9\n"; $Eof=1; last _SEL_LOOP9; } !defined $Reply and die "REPLY accessed, while undefined"; chomp $Reply; # undo emboldening of user input defined "" and "" ne "" and print STDERR ""; #print STDERR "$Shell::POSIX::Select::menu\n$Shell::POSIX::Select::Prompt "; if ( $Reply eq "" ) { # interpreted as re-print menu request # Empty input is legit, means redisplay menu $Shell::POSIX::Select::U_WARN > 1 and warn "\tINPUT IS: empty\n"; $Shell::POSIX::Select::bad = $Shell::POSIX::Select::do_prompt[9] = 1; } elsif ( $Reply =~ /\D/ ) { # shouldn't be any non-digit! $Shell::POSIX::Select::U_WARN > 0 and warn "\tINPUT CONTAINS NON-DIGIT: '$Reply'\n"; $Shell::POSIX::Select::bad = 1; # Korn and Bash shell just ignore this case } elsif ( $Reply < 1 or $Reply > $Shell::POSIX::Select::num_values ) { $Shell::POSIX::Select::U_WARN > 0 and warn "\t'$Reply' IS NOT IN RANGE: 1 - $Shell::POSIX::Select::num_values\n"; $Shell::POSIX::Select::bad = 1; # Korn and Bash shell just ignore this case } # warn "BAD is now: $Shell::POSIX::Select::bad"; $Shell::POSIX::Select::bad or 0 > 2 and warn "About to last out of Reply Validator Loop "; $Shell::POSIX::Select::bad or last; # REPLY VALIDATOR EXITED HERE } # if for validating user input } # infinite while for validating user input $qx = $Shell::POSIX::Select::looplist[$Reply - 1]; # set users' variable # USER'S LOOP-BLOCK BELOW print "$qx\n";; # USER'S LOOP-BLOCK ABOVE # Making sure there's colon (maybe # even two) after codestring above, # in case user omitted after last # statement in block. I might add # another statement below it someday! 0 > 2 and warn "At end of prompt-repeating loop "; } # infinite while for repeating collection of selections 0 and warn "BEYOND end of prompt-repeating loop "; } # endif (defined $Shell::POSIX::Select::menu) else { $Shell::POSIX::Select::DEBUG > 0 and warn "Shell::POSIX::Select: Select Loop #9 has no list, so no iterations\n"; if ( $Shell::POSIX::Select::dump_data ) { $Reply = undef; # dump filtered source for comparison against expected print STDERR "copacetic "; # ensure some output, and flush pending exit 222; # code for graceful, expected, early exit } } # return omitted above, to get last expression's value # returned automatically, just like shell's version } # **** END NEW SCOPE FOR SELECTLOOP #9 **** } # **** END WRAPPER SCOPE FOR SELECTLOOP #9 **** # vi:ts=2 sw=2: