Debian Codegraph @

Ref_Data/loop_variable_names.cdump_ref

raw
1
2
3 # Code generated by Shell::POSIX::Select v0.09, by tim(AT)TeachMePerl.com
4 # NOTA BENE: Line 1 of this segment must start with {, so user can LABEL it
5 { # **** NEW WRAPPER SCOPE FOR SELECTLOOP #1 ****
6 $Shell::POSIX::Select::DEBUG > 1 and 1 == 1 and
7 warn "LINE NUMBER FOR START OF USER CODE_BLOCK IS: ", __LINE__, "\n";
8 _SEL_LOOP1: { # **** NEW SCOPE FOR SELECTLOOP #1 ****
9
10 # critical for values's contents to be resolved in user's scope
11 local @Shell::POSIX::Select::looplist=(@ARGV);
12 local $Shell::POSIX::Select::num_values=@Shell::POSIX::Select::looplist;
13
14 $Shell::POSIX::Select::DEBUG > 4 and do {
15 warn "ARRAY VALUES ARE: @Shell::POSIX::Select::looplist\n";
16 warn "NUM VALUES is $Shell::POSIX::Select::num_values\n";
17 warn "user-program debug level is $Shell::POSIX::Select::U_WARN\n";
18 };
19 ; # NO DECLARATION OF LOOP-VAR REQUESTED # loop-var declaration appears here
20
21 ;
22 local (
23 $Shell::POSIX::Select::Prompt[1],
24 $Shell::POSIX::Select::menu
25 ) =
26 Shell::POSIX::Select::make_menu(
27 $Shell::POSIX::Select::Heading || "",
28 $Shell::POSIX::Select::Prompt || "" , # Might be overridden in make_menu
29 @Shell::POSIX::Select::looplist
30 );
31
32 # no point in prompting a pipe!
33 local $Shell::POSIX::Select::do_prompt[1] = (-t) ? 1 : 0 ;
34 0 > 2 and warn "do_prompt is $Shell::POSIX::Select::do_prompt[1]\n";
35 if ( defined $Shell::POSIX::Select::menu ) { # No list, no iterations!
36 while (1) { # for repeating prompt for selections
37 # localize, so I don't have to reset for
38 # outer loop on exit from inner
39 local ($Reply);
40 while (1) { # for validating user's input
41 local $Shell::POSIX::Select::bad = 0;
42
43 # local decl suppresses newline on prompt when -l switch turned on
44 {
45 local $\;
46 if ($Shell::POSIX::Select::do_prompt[1]) {
47
48 # When transferring from INNER to OUTER loop,
49 # extra NL before prompt is visually desirable
50
51 if ( $Shell::POSIX::Select::_extra_nl) {
52 print STDERR "\n\n";
53 $Shell::POSIX::Select::_extra_nl=0;
54 }
55 print STDERR
56 "$Shell::POSIX::Select::menu\n$Shell::POSIX::Select::Prompt[1] ";
57 }
58 }
59
60 # $Shell::POSIX::Select::do_prompt=0;
61 # constant prompting depends on style
62 $Shell::POSIX::Select::do_prompt[1]= 0;
63
64 if ( $Shell::POSIX::Select::dump_data ) {
65 $Reply = undef;
66 # dump filtered source for comparison against expected
67 print STDERR "copacetic
68 "; # ensure some output, and flush pending
69 exit 222; # code for graceful, expected, early exit
70 }
71 else {
72 # $^W=0;
73 # warn "Waiting for input";
74 $Eof=0;
75 $Reply = <STDIN>;
76 # warn "Got input";
77 # $^W=1;
78
79 if ( !defined( $Reply ) ) {
80 defined "" and "" ne "" and print STDERR "";
81
82 # need to undef loop var; user may check it!
83 undef $m;
84
85 # last Shell::POSIX::Select::_SEL_LOOP1; # Syntax error!
86 # If returning to outer loop, show the prompt for it
87 # warn "User hit ^D";
88 if ( 1 > 1 and -t ) { # reset prompting for outer loop
89 $Shell::POSIX::Select::do_prompt[1-1] = 1; $Shell::POSIX::Select::_extra_nl=1;
90 }
91 0 > 2 and warn "Lasting out of _SEL_LOOP1\n";
92 $Eof=1;
93 last _SEL_LOOP1;
94 }
95 !defined $Reply and die "REPLY accessed, while undefined";
96 chomp $Reply;
97
98 # undo emboldening of user input
99 defined "" and "" ne "" and print STDERR "";
100
101 #print STDERR "$Shell::POSIX::Select::menu\n$Shell::POSIX::Select::Prompt ";
102 if ( $Reply eq "" ) { # interpreted as re-print menu request
103 # Empty input is legit, means redisplay menu
104 $Shell::POSIX::Select::U_WARN > 1 and warn "\tINPUT IS: empty\n";
105 $Shell::POSIX::Select::bad = $Shell::POSIX::Select::do_prompt[1] = 1;
106 }
107 elsif ( $Reply =~ /\D/ ) { # shouldn't be any non-digit!
108 $Shell::POSIX::Select::U_WARN > 0
109 and warn "\tINPUT CONTAINS NON-DIGIT: '$Reply'\n";
110 $Shell::POSIX::Select::bad = 1; # Korn and Bash shell just ignore this case
111 }
112 elsif ( $Reply < 1 or $Reply > $Shell::POSIX::Select::num_values ) {
113 $Shell::POSIX::Select::U_WARN > 0
114 and warn
115 "\t'$Reply' IS NOT IN RANGE: 1 - $Shell::POSIX::Select::num_values\n";
116 $Shell::POSIX::Select::bad = 1; # Korn and Bash shell just ignore this case
117 }
118
119 # warn "BAD is now: $Shell::POSIX::Select::bad";
120 $Shell::POSIX::Select::bad or
121 0 > 2 and warn "About to last out of Reply Validator Loop
122 ";
123 $Shell::POSIX::Select::bad or last; # REPLY VALIDATOR EXITED HERE
124 } # if for validating user input
125 } # infinite while for validating user input
126
127 $m = $Shell::POSIX::Select::looplist[$Reply - 1]; # set users' variable
128
129 # USER'S LOOP-BLOCK BELOW
130 print "$m\n";;
131
132 # USER'S LOOP-BLOCK ABOVE
133 # Making sure there's colon (maybe
134 # even two) after codestring above,
135 # in case user omitted after last
136 # statement in block. I might add
137 # another statement below it someday!
138 0 > 2 and warn "At end of prompt-repeating loop
139 ";
140 } # infinite while for repeating collection of selections
141 0 and warn "BEYOND end of prompt-repeating loop
142 ";
143 } # endif (defined $Shell::POSIX::Select::menu)
144 else {
145 $Shell::POSIX::Select::DEBUG > 0 and warn "Shell::POSIX::Select: Select Loop #1 has no list, so no iterations\n";
146
147 if ( $Shell::POSIX::Select::dump_data ) {
148 $Reply = undef;
149 # dump filtered source for comparison against expected
150 print STDERR "copacetic
151 "; # ensure some output, and flush pending
152 exit 222; # code for graceful, expected, early exit
153 }
154 }
155 # return omitted above, to get last expression's value
156 # returned automatically, just like shell's version
157
158
159 } # **** END NEW SCOPE FOR SELECTLOOP #1 ****
160 } # **** END WRAPPER SCOPE FOR SELECTLOOP #1 ****
161 # vi:ts=2 sw=2:
162
163
164 # Code generated by Shell::POSIX::Select v0.09, by tim(AT)TeachMePerl.com
165 # NOTA BENE: Line 1 of this segment must start with {, so user can LABEL it
166 { # **** NEW WRAPPER SCOPE FOR SELECTLOOP #2 ****
167 $Shell::POSIX::Select::DEBUG > 1 and 2 == 1 and
168 warn "LINE NUMBER FOR START OF USER CODE_BLOCK IS: ", __LINE__, "\n";
169 _SEL_LOOP2: { # **** NEW SCOPE FOR SELECTLOOP #2 ****
170
171 # critical for values's contents to be resolved in user's scope
172 local @Shell::POSIX::Select::looplist=(@ARGV);
173 local $Shell::POSIX::Select::num_values=@Shell::POSIX::Select::looplist;
174
175 $Shell::POSIX::Select::DEBUG > 4 and do {
176 warn "ARRAY VALUES ARE: @Shell::POSIX::Select::looplist\n";
177 warn "NUM VALUES is $Shell::POSIX::Select::num_values\n";
178 warn "user-program debug level is $Shell::POSIX::Select::U_WARN\n";
179 };
180 ; # NO DECLARATION OF LOOP-VAR REQUESTED # loop-var declaration appears here
181
182 ;
183 local (
184 $Shell::POSIX::Select::Prompt[2],
185 $Shell::POSIX::Select::menu
186 ) =
187 Shell::POSIX::Select::make_menu(
188 $Shell::POSIX::Select::Heading || "",
189 $Shell::POSIX::Select::Prompt || "" , # Might be overridden in make_menu
190 @Shell::POSIX::Select::looplist
191 );
192
193 # no point in prompting a pipe!
194 local $Shell::POSIX::Select::do_prompt[2] = (-t) ? 1 : 0 ;
195 0 > 2 and warn "do_prompt is $Shell::POSIX::Select::do_prompt[2]\n";
196 if ( defined $Shell::POSIX::Select::menu ) { # No list, no iterations!
197 while (1) { # for repeating prompt for selections
198 # localize, so I don't have to reset for
199 # outer loop on exit from inner
200 local ($Reply);
201 while (1) { # for validating user's input
202 local $Shell::POSIX::Select::bad = 0;
203
204 # local decl suppresses newline on prompt when -l switch turned on
205 {
206 local $\;
207 if ($Shell::POSIX::Select::do_prompt[2]) {
208
209 # When transferring from INNER to OUTER loop,
210 # extra NL before prompt is visually desirable
211
212 if ( $Shell::POSIX::Select::_extra_nl) {
213 print STDERR "\n\n";
214 $Shell::POSIX::Select::_extra_nl=0;
215 }
216 print STDERR
217 "$Shell::POSIX::Select::menu\n$Shell::POSIX::Select::Prompt[2] ";
218 }
219 }
220
221 # $Shell::POSIX::Select::do_prompt=0;
222 # constant prompting depends on style
223 $Shell::POSIX::Select::do_prompt[2]= 0;
224
225 if ( $Shell::POSIX::Select::dump_data ) {
226 $Reply = undef;
227 # dump filtered source for comparison against expected
228 print STDERR "copacetic
229 "; # ensure some output, and flush pending
230 exit 222; # code for graceful, expected, early exit
231 }
232 else {
233 # $^W=0;
234 # warn "Waiting for input";
235 $Eof=0;
236 $Reply = <STDIN>;
237 # warn "Got input";
238 # $^W=1;
239
240 if ( !defined( $Reply ) ) {
241 defined "" and "" ne "" and print STDERR "";
242
243 # need to undef loop var; user may check it!
244 undef $a;
245
246 # last Shell::POSIX::Select::_SEL_LOOP2; # Syntax error!
247 # If returning to outer loop, show the prompt for it
248 # warn "User hit ^D";
249 if ( 2 > 1 and -t ) { # reset prompting for outer loop
250 $Shell::POSIX::Select::do_prompt[2-1] = 1; $Shell::POSIX::Select::_extra_nl=1;
251 }
252 0 > 2 and warn "Lasting out of _SEL_LOOP2\n";
253 $Eof=1;
254 last _SEL_LOOP2;
255 }
256 !defined $Reply and die "REPLY accessed, while undefined";
257 chomp $Reply;
258
259 # undo emboldening of user input
260 defined "" and "" ne "" and print STDERR "";
261
262 #print STDERR "$Shell::POSIX::Select::menu\n$Shell::POSIX::Select::Prompt ";
263 if ( $Reply eq "" ) { # interpreted as re-print menu request
264 # Empty input is legit, means redisplay menu
265 $Shell::POSIX::Select::U_WARN > 1 and warn "\tINPUT IS: empty\n";
266 $Shell::POSIX::Select::bad = $Shell::POSIX::Select::do_prompt[2] = 1;
267 }
268 elsif ( $Reply =~ /\D/ ) { # shouldn't be any non-digit!
269 $Shell::POSIX::Select::U_WARN > 0
270 and warn "\tINPUT CONTAINS NON-DIGIT: '$Reply'\n";
271 $Shell::POSIX::Select::bad = 1; # Korn and Bash shell just ignore this case
272 }
273 elsif ( $Reply < 1 or $Reply > $Shell::POSIX::Select::num_values ) {
274 $Shell::POSIX::Select::U_WARN > 0
275 and warn
276 "\t'$Reply' IS NOT IN RANGE: 1 - $Shell::POSIX::Select::num_values\n";
277 $Shell::POSIX::Select::bad = 1; # Korn and Bash shell just ignore this case
278 }
279
280 # warn "BAD is now: $Shell::POSIX::Select::bad";
281 $Shell::POSIX::Select::bad or
282 0 > 2 and warn "About to last out of Reply Validator Loop
283 ";
284 $Shell::POSIX::Select::bad or last; # REPLY VALIDATOR EXITED HERE
285 } # if for validating user input
286 } # infinite while for validating user input
287
288 $a = $Shell::POSIX::Select::looplist[$Reply - 1]; # set users' variable
289
290 # USER'S LOOP-BLOCK BELOW
291 print "$a\n";;
292
293 # USER'S LOOP-BLOCK ABOVE
294 # Making sure there's colon (maybe
295 # even two) after codestring above,
296 # in case user omitted after last
297 # statement in block. I might add
298 # another statement below it someday!
299 0 > 2 and warn "At end of prompt-repeating loop
300 ";
301 } # infinite while for repeating collection of selections
302 0 and warn "BEYOND end of prompt-repeating loop
303 ";
304 } # endif (defined $Shell::POSIX::Select::menu)
305 else {
306 $Shell::POSIX::Select::DEBUG > 0 and warn "Shell::POSIX::Select: Select Loop #2 has no list, so no iterations\n";
307
308 if ( $Shell::POSIX::Select::dump_data ) {
309 $Reply = undef;
310 # dump filtered source for comparison against expected
311 print STDERR "copacetic
312 "; # ensure some output, and flush pending
313 exit 222; # code for graceful, expected, early exit
314 }
315 }
316 # return omitted above, to get last expression's value
317 # returned automatically, just like shell's version
318
319
320 } # **** END NEW SCOPE FOR SELECTLOOP #2 ****
321 } # **** END WRAPPER SCOPE FOR SELECTLOOP #2 ****
322 # vi:ts=2 sw=2:
323
324
325 # Code generated by Shell::POSIX::Select v0.09, by tim(AT)TeachMePerl.com
326 # NOTA BENE: Line 1 of this segment must start with {, so user can LABEL it
327 { # **** NEW WRAPPER SCOPE FOR SELECTLOOP #3 ****
328 $Shell::POSIX::Select::DEBUG > 1 and 3 == 1 and
329 warn "LINE NUMBER FOR START OF USER CODE_BLOCK IS: ", __LINE__, "\n";
330 _SEL_LOOP3: { # **** NEW SCOPE FOR SELECTLOOP #3 ****
331
332 # critical for values's contents to be resolved in user's scope
333 local @Shell::POSIX::Select::looplist=(@ARGV);
334 local $Shell::POSIX::Select::num_values=@Shell::POSIX::Select::looplist;
335
336 $Shell::POSIX::Select::DEBUG > 4 and do {
337 warn "ARRAY VALUES ARE: @Shell::POSIX::Select::looplist\n";
338 warn "NUM VALUES is $Shell::POSIX::Select::num_values\n";
339 warn "user-program debug level is $Shell::POSIX::Select::U_WARN\n";
340 };
341 ; # NO DECLARATION OF LOOP-VAR REQUESTED # loop-var declaration appears here
342
343 ;
344 local (
345 $Shell::POSIX::Select::Prompt[3],
346 $Shell::POSIX::Select::menu
347 ) =
348 Shell::POSIX::Select::make_menu(
349 $Shell::POSIX::Select::Heading || "",
350 $Shell::POSIX::Select::Prompt || "" , # Might be overridden in make_menu
351 @Shell::POSIX::Select::looplist
352 );
353
354 # no point in prompting a pipe!
355 local $Shell::POSIX::Select::do_prompt[3] = (-t) ? 1 : 0 ;
356 0 > 2 and warn "do_prompt is $Shell::POSIX::Select::do_prompt[3]\n";
357 if ( defined $Shell::POSIX::Select::menu ) { # No list, no iterations!
358 while (1) { # for repeating prompt for selections
359 # localize, so I don't have to reset for
360 # outer loop on exit from inner
361 local ($Reply);
362 while (1) { # for validating user's input
363 local $Shell::POSIX::Select::bad = 0;
364
365 # local decl suppresses newline on prompt when -l switch turned on
366 {
367 local $\;
368 if ($Shell::POSIX::Select::do_prompt[3]) {
369
370 # When transferring from INNER to OUTER loop,
371 # extra NL before prompt is visually desirable
372
373 if ( $Shell::POSIX::Select::_extra_nl) {
374 print STDERR "\n\n";
375 $Shell::POSIX::Select::_extra_nl=0;
376 }
377 print STDERR
378 "$Shell::POSIX::Select::menu\n$Shell::POSIX::Select::Prompt[3] ";
379 }
380 }
381
382 # $Shell::POSIX::Select::do_prompt=0;
383 # constant prompting depends on style
384 $Shell::POSIX::Select::do_prompt[3]= 0;
385
386 if ( $Shell::POSIX::Select::dump_data ) {
387 $Reply = undef;
388 # dump filtered source for comparison against expected
389 print STDERR "copacetic
390 "; # ensure some output, and flush pending
391 exit 222; # code for graceful, expected, early exit
392 }
393 else {
394 # $^W=0;
395 # warn "Waiting for input";
396 $Eof=0;
397 $Reply = <STDIN>;
398 # warn "Got input";
399 # $^W=1;
400
401 if ( !defined( $Reply ) ) {
402 defined "" and "" ne "" and print STDERR "";
403
404 # need to undef loop var; user may check it!
405 undef $s;
406
407 # last Shell::POSIX::Select::_SEL_LOOP3; # Syntax error!
408 # If returning to outer loop, show the prompt for it
409 # warn "User hit ^D";
410 if ( 3 > 1 and -t ) { # reset prompting for outer loop
411 $Shell::POSIX::Select::do_prompt[3-1] = 1; $Shell::POSIX::Select::_extra_nl=1;
412 }
413 0 > 2 and warn "Lasting out of _SEL_LOOP3\n";
414 $Eof=1;
415 last _SEL_LOOP3;
416 }
417 !defined $Reply and die "REPLY accessed, while undefined";
418 chomp $Reply;
419
420 # undo emboldening of user input
421 defined "" and "" ne "" and print STDERR "";
422
423 #print STDERR "$Shell::POSIX::Select::menu\n$Shell::POSIX::Select::Prompt ";
424 if ( $Reply eq "" ) { # interpreted as re-print menu request
425 # Empty input is legit, means redisplay menu
426 $Shell::POSIX::Select::U_WARN > 1 and warn "\tINPUT IS: empty\n";
427 $Shell::POSIX::Select::bad = $Shell::POSIX::Select::do_prompt[3] = 1;
428 }
429 elsif ( $Reply =~ /\D/ ) { # shouldn't be any non-digit!
430 $Shell::POSIX::Select::U_WARN > 0
431 and warn "\tINPUT CONTAINS NON-DIGIT: '$Reply'\n";
432 $Shell::POSIX::Select::bad = 1; # Korn and Bash shell just ignore this case
433 }
434 elsif ( $Reply < 1 or $Reply > $Shell::POSIX::Select::num_values ) {
435 $Shell::POSIX::Select::U_WARN > 0
436 and warn
437 "\t'$Reply' IS NOT IN RANGE: 1 - $Shell::POSIX::Select::num_values\n";
438 $Shell::POSIX::Select::bad = 1; # Korn and Bash shell just ignore this case
439 }
440
441 # warn "BAD is now: $Shell::POSIX::Select::bad";
442 $Shell::POSIX::Select::bad or
443 0 > 2 and warn "About to last out of Reply Validator Loop
444 ";
445 $Shell::POSIX::Select::bad or last; # REPLY VALIDATOR EXITED HERE
446 } # if for validating user input
447 } # infinite while for validating user input
448
449 $s = $Shell::POSIX::Select::looplist[$Reply - 1]; # set users' variable
450
451 # USER'S LOOP-BLOCK BELOW
452 print "$s\n";;
453
454 # USER'S LOOP-BLOCK ABOVE
455 # Making sure there's colon (maybe
456 # even two) after codestring above,
457 # in case user omitted after last
458 # statement in block. I might add
459 # another statement below it someday!
460 0 > 2 and warn "At end of prompt-repeating loop
461 ";
462 } # infinite while for repeating collection of selections
463 0 and warn "BEYOND end of prompt-repeating loop
464 ";
465 } # endif (defined $Shell::POSIX::Select::menu)
466 else {
467 $Shell::POSIX::Select::DEBUG > 0 and warn "Shell::POSIX::Select: Select Loop #3 has no list, so no iterations\n";
468
469 if ( $Shell::POSIX::Select::dump_data ) {
470 $Reply = undef;
471 # dump filtered source for comparison against expected
472 print STDERR "copacetic
473 "; # ensure some output, and flush pending
474 exit 222; # code for graceful, expected, early exit
475 }
476 }
477 # return omitted above, to get last expression's value
478 # returned automatically, just like shell's version
479
480
481 } # **** END NEW SCOPE FOR SELECTLOOP #3 ****
482 } # **** END WRAPPER SCOPE FOR SELECTLOOP #3 ****
483 # vi:ts=2 sw=2:
484
485
486 # Code generated by Shell::POSIX::Select v0.09, by tim(AT)TeachMePerl.com
487 # NOTA BENE: Line 1 of this segment must start with {, so user can LABEL it
488 { # **** NEW WRAPPER SCOPE FOR SELECTLOOP #4 ****
489 $Shell::POSIX::Select::DEBUG > 1 and 4 == 1 and
490 warn "LINE NUMBER FOR START OF USER CODE_BLOCK IS: ", __LINE__, "\n";
491 _SEL_LOOP4: { # **** NEW SCOPE FOR SELECTLOOP #4 ****
492
493 # critical for values's contents to be resolved in user's scope
494 local @Shell::POSIX::Select::looplist=(@ARGV);
495 local $Shell::POSIX::Select::num_values=@Shell::POSIX::Select::looplist;
496
497 $Shell::POSIX::Select::DEBUG > 4 and do {
498 warn "ARRAY VALUES ARE: @Shell::POSIX::Select::looplist\n";
499 warn "NUM VALUES is $Shell::POSIX::Select::num_values\n";
500 warn "user-program debug level is $Shell::POSIX::Select::U_WARN\n";
501 };
502 ; # NO DECLARATION OF LOOP-VAR REQUESTED # loop-var declaration appears here
503
504 ;
505 local (
506 $Shell::POSIX::Select::Prompt[4],
507 $Shell::POSIX::Select::menu
508 ) =
509 Shell::POSIX::Select::make_menu(
510 $Shell::POSIX::Select::Heading || "",
511 $Shell::POSIX::Select::Prompt || "" , # Might be overridden in make_menu
512 @Shell::POSIX::Select::looplist
513 );
514
515 # no point in prompting a pipe!
516 local $Shell::POSIX::Select::do_prompt[4] = (-t) ? 1 : 0 ;
517 0 > 2 and warn "do_prompt is $Shell::POSIX::Select::do_prompt[4]\n";
518 if ( defined $Shell::POSIX::Select::menu ) { # No list, no iterations!
519 while (1) { # for repeating prompt for selections
520 # localize, so I don't have to reset for
521 # outer loop on exit from inner
522 local ($Reply);
523 while (1) { # for validating user's input
524 local $Shell::POSIX::Select::bad = 0;
525
526 # local decl suppresses newline on prompt when -l switch turned on
527 {
528 local $\;
529 if ($Shell::POSIX::Select::do_prompt[4]) {
530
531 # When transferring from INNER to OUTER loop,
532 # extra NL before prompt is visually desirable
533
534 if ( $Shell::POSIX::Select::_extra_nl) {
535 print STDERR "\n\n";
536 $Shell::POSIX::Select::_extra_nl=0;
537 }
538 print STDERR
539 "$Shell::POSIX::Select::menu\n$Shell::POSIX::Select::Prompt[4] ";
540 }
541 }
542
543 # $Shell::POSIX::Select::do_prompt=0;
544 # constant prompting depends on style
545 $Shell::POSIX::Select::do_prompt[4]= 0;
546
547 if ( $Shell::POSIX::Select::dump_data ) {
548 $Reply = undef;
549 # dump filtered source for comparison against expected
550 print STDERR "copacetic
551 "; # ensure some output, and flush pending
552 exit 222; # code for graceful, expected, early exit
553 }
554 else {
555 # $^W=0;
556 # warn "Waiting for input";
557 $Eof=0;
558 $Reply = <STDIN>;
559 # warn "Got input";
560 # $^W=1;
561
562 if ( !defined( $Reply ) ) {
563 defined "" and "" ne "" and print STDERR "";
564
565 # need to undef loop var; user may check it!
566 undef $y;
567
568 # last Shell::POSIX::Select::_SEL_LOOP4; # Syntax error!
569 # If returning to outer loop, show the prompt for it
570 # warn "User hit ^D";
571 if ( 4 > 1 and -t ) { # reset prompting for outer loop
572 $Shell::POSIX::Select::do_prompt[4-1] = 1; $Shell::POSIX::Select::_extra_nl=1;
573 }
574 0 > 2 and warn "Lasting out of _SEL_LOOP4\n";
575 $Eof=1;
576 last _SEL_LOOP4;
577 }
578 !defined $Reply and die "REPLY accessed, while undefined";
579 chomp $Reply;
580
581 # undo emboldening of user input
582 defined "" and "" ne "" and print STDERR "";
583
584 #print STDERR "$Shell::POSIX::Select::menu\n$Shell::POSIX::Select::Prompt ";
585 if ( $Reply eq "" ) { # interpreted as re-print menu request
586 # Empty input is legit, means redisplay menu
587 $Shell::POSIX::Select::U_WARN > 1 and warn "\tINPUT IS: empty\n";
588 $Shell::POSIX::Select::bad = $Shell::POSIX::Select::do_prompt[4] = 1;
589 }
590 elsif ( $Reply =~ /\D/ ) { # shouldn't be any non-digit!
591 $Shell::POSIX::Select::U_WARN > 0
592 and warn "\tINPUT CONTAINS NON-DIGIT: '$Reply'\n";
593 $Shell::POSIX::Select::bad = 1; # Korn and Bash shell just ignore this case
594 }
595 elsif ( $Reply < 1 or $Reply > $Shell::POSIX::Select::num_values ) {
596 $Shell::POSIX::Select::U_WARN > 0
597 and warn
598 "\t'$Reply' IS NOT IN RANGE: 1 - $Shell::POSIX::Select::num_values\n";
599 $Shell::POSIX::Select::bad = 1; # Korn and Bash shell just ignore this case
600 }
601
602 # warn "BAD is now: $Shell::POSIX::Select::bad";
603 $Shell::POSIX::Select::bad or
604 0 > 2 and warn "About to last out of Reply Validator Loop
605 ";
606 $Shell::POSIX::Select::bad or last; # REPLY VALIDATOR EXITED HERE
607 } # if for validating user input
608 } # infinite while for validating user input
609
610 $y = $Shell::POSIX::Select::looplist[$Reply - 1]; # set users' variable
611
612 # USER'S LOOP-BLOCK BELOW
613 print "$y\n";;
614
615 # USER'S LOOP-BLOCK ABOVE
616 # Making sure there's colon (maybe
617 # even two) after codestring above,
618 # in case user omitted after last
619 # statement in block. I might add
620 # another statement below it someday!
621 0 > 2 and warn "At end of prompt-repeating loop
622 ";
623 } # infinite while for repeating collection of selections
624 0 and warn "BEYOND end of prompt-repeating loop
625 ";
626 } # endif (defined $Shell::POSIX::Select::menu)
627 else {
628 $Shell::POSIX::Select::DEBUG > 0 and warn "Shell::POSIX::Select: Select Loop #4 has no list, so no iterations\n";
629
630 if ( $Shell::POSIX::Select::dump_data ) {
631 $Reply = undef;
632 # dump filtered source for comparison against expected
633 print STDERR "copacetic
634 "; # ensure some output, and flush pending
635 exit 222; # code for graceful, expected, early exit
636 }
637 }
638 # return omitted above, to get last expression's value
639 # returned automatically, just like shell's version
640
641
642 } # **** END NEW SCOPE FOR SELECTLOOP #4 ****
643 } # **** END WRAPPER SCOPE FOR SELECTLOOP #4 ****
644 # vi:ts=2 sw=2:
645
646
647 # Code generated by Shell::POSIX::Select v0.09, by tim(AT)TeachMePerl.com
648 # NOTA BENE: Line 1 of this segment must start with {, so user can LABEL it
649 { # **** NEW WRAPPER SCOPE FOR SELECTLOOP #5 ****
650 $Shell::POSIX::Select::DEBUG > 1 and 5 == 1 and
651 warn "LINE NUMBER FOR START OF USER CODE_BLOCK IS: ", __LINE__, "\n";
652 _SEL_LOOP5: { # **** NEW SCOPE FOR SELECTLOOP #5 ****
653
654 # critical for values's contents to be resolved in user's scope
655 local @Shell::POSIX::Select::looplist=(@ARGV);
656 local $Shell::POSIX::Select::num_values=@Shell::POSIX::Select::looplist;
657
658 $Shell::POSIX::Select::DEBUG > 4 and do {
659 warn "ARRAY VALUES ARE: @Shell::POSIX::Select::looplist\n";
660 warn "NUM VALUES is $Shell::POSIX::Select::num_values\n";
661 warn "user-program debug level is $Shell::POSIX::Select::U_WARN\n";
662 };
663 ; # NO DECLARATION OF LOOP-VAR REQUESTED # loop-var declaration appears here
664
665 ;
666 local (
667 $Shell::POSIX::Select::Prompt[5],
668 $Shell::POSIX::Select::menu
669 ) =
670 Shell::POSIX::Select::make_menu(
671 $Shell::POSIX::Select::Heading || "",
672 $Shell::POSIX::Select::Prompt || "" , # Might be overridden in make_menu
673 @Shell::POSIX::Select::looplist
674 );
675
676 # no point in prompting a pipe!
677 local $Shell::POSIX::Select::do_prompt[5] = (-t) ? 1 : 0 ;
678 0 > 2 and warn "do_prompt is $Shell::POSIX::Select::do_prompt[5]\n";
679 if ( defined $Shell::POSIX::Select::menu ) { # No list, no iterations!
680 while (1) { # for repeating prompt for selections
681 # localize, so I don't have to reset for
682 # outer loop on exit from inner
683 local ($Reply);
684 while (1) { # for validating user's input
685 local $Shell::POSIX::Select::bad = 0;
686
687 # local decl suppresses newline on prompt when -l switch turned on
688 {
689 local $\;
690 if ($Shell::POSIX::Select::do_prompt[5]) {
691
692 # When transferring from INNER to OUTER loop,
693 # extra NL before prompt is visually desirable
694
695 if ( $Shell::POSIX::Select::_extra_nl) {
696 print STDERR "\n\n";
697 $Shell::POSIX::Select::_extra_nl=0;
698 }
699 print STDERR
700 "$Shell::POSIX::Select::menu\n$Shell::POSIX::Select::Prompt[5] ";
701 }
702 }
703
704 # $Shell::POSIX::Select::do_prompt=0;
705 # constant prompting depends on style
706 $Shell::POSIX::Select::do_prompt[5]= 0;
707
708 if ( $Shell::POSIX::Select::dump_data ) {
709 $Reply = undef;
710 # dump filtered source for comparison against expected
711 print STDERR "copacetic
712 "; # ensure some output, and flush pending
713 exit 222; # code for graceful, expected, early exit
714 }
715 else {
716 # $^W=0;
717 # warn "Waiting for input";
718 $Eof=0;
719 $Reply = <STDIN>;
720 # warn "Got input";
721 # $^W=1;
722
723 if ( !defined( $Reply ) ) {
724 defined "" and "" ne "" and print STDERR "";
725
726 # need to undef loop var; user may check it!
727 undef $tr;
728
729 # last Shell::POSIX::Select::_SEL_LOOP5; # Syntax error!
730 # If returning to outer loop, show the prompt for it
731 # warn "User hit ^D";
732 if ( 5 > 1 and -t ) { # reset prompting for outer loop
733 $Shell::POSIX::Select::do_prompt[5-1] = 1; $Shell::POSIX::Select::_extra_nl=1;
734 }
735 0 > 2 and warn "Lasting out of _SEL_LOOP5\n";
736 $Eof=1;
737 last _SEL_LOOP5;
738 }
739 !defined $Reply and die "REPLY accessed, while undefined";
740 chomp $Reply;
741
742 # undo emboldening of user input
743 defined "" and "" ne "" and print STDERR "";
744
745 #print STDERR "$Shell::POSIX::Select::menu\n$Shell::POSIX::Select::Prompt ";
746 if ( $Reply eq "" ) { # interpreted as re-print menu request
747 # Empty input is legit, means redisplay menu
748 $Shell::POSIX::Select::U_WARN > 1 and warn "\tINPUT IS: empty\n";
749 $Shell::POSIX::Select::bad = $Shell::POSIX::Select::do_prompt[5] = 1;
750 }
751 elsif ( $Reply =~ /\D/ ) { # shouldn't be any non-digit!
752 $Shell::POSIX::Select::U_WARN > 0
753 and warn "\tINPUT CONTAINS NON-DIGIT: '$Reply'\n";
754 $Shell::POSIX::Select::bad = 1; # Korn and Bash shell just ignore this case
755 }
756 elsif ( $Reply < 1 or $Reply > $Shell::POSIX::Select::num_values ) {
757 $Shell::POSIX::Select::U_WARN > 0
758 and warn
759 "\t'$Reply' IS NOT IN RANGE: 1 - $Shell::POSIX::Select::num_values\n";
760 $Shell::POSIX::Select::bad = 1; # Korn and Bash shell just ignore this case
761 }
762
763 # warn "BAD is now: $Shell::POSIX::Select::bad";
764 $Shell::POSIX::Select::bad or
765 0 > 2 and warn "About to last out of Reply Validator Loop
766 ";
767 $Shell::POSIX::Select::bad or last; # REPLY VALIDATOR EXITED HERE
768 } # if for validating user input
769 } # infinite while for validating user input
770
771 $tr = $Shell::POSIX::Select::looplist[$Reply - 1]; # set users' variable
772
773 # USER'S LOOP-BLOCK BELOW
774 print "$tr\n";;
775
776 # USER'S LOOP-BLOCK ABOVE
777 # Making sure there's colon (maybe
778 # even two) after codestring above,
779 # in case user omitted after last
780 # statement in block. I might add
781 # another statement below it someday!
782 0 > 2 and warn "At end of prompt-repeating loop
783 ";
784 } # infinite while for repeating collection of selections
785 0 and warn "BEYOND end of prompt-repeating loop
786 ";
787 } # endif (defined $Shell::POSIX::Select::menu)
788 else {
789 $Shell::POSIX::Select::DEBUG > 0 and warn "Shell::POSIX::Select: Select Loop #5 has no list, so no iterations\n";
790
791 if ( $Shell::POSIX::Select::dump_data ) {
792 $Reply = undef;
793 # dump filtered source for comparison against expected
794 print STDERR "copacetic
795 "; # ensure some output, and flush pending
796 exit 222; # code for graceful, expected, early exit
797 }
798 }
799 # return omitted above, to get last expression's value
800 # returned automatically, just like shell's version
801
802
803 } # **** END NEW SCOPE FOR SELECTLOOP #5 ****
804 } # **** END WRAPPER SCOPE FOR SELECTLOOP #5 ****
805 # vi:ts=2 sw=2:
806
807
808 # Code generated by Shell::POSIX::Select v0.09, by tim(AT)TeachMePerl.com
809 # NOTA BENE: Line 1 of this segment must start with {, so user can LABEL it
810 { # **** NEW WRAPPER SCOPE FOR SELECTLOOP #6 ****
811 $Shell::POSIX::Select::DEBUG > 1 and 6 == 1 and
812 warn "LINE NUMBER FOR START OF USER CODE_BLOCK IS: ", __LINE__, "\n";
813 _SEL_LOOP6: { # **** NEW SCOPE FOR SELECTLOOP #6 ****
814
815 # critical for values's contents to be resolved in user's scope
816 local @Shell::POSIX::Select::looplist=(@ARGV);
817 local $Shell::POSIX::Select::num_values=@Shell::POSIX::Select::looplist;
818
819 $Shell::POSIX::Select::DEBUG > 4 and do {
820 warn "ARRAY VALUES ARE: @Shell::POSIX::Select::looplist\n";
821 warn "NUM VALUES is $Shell::POSIX::Select::num_values\n";
822 warn "user-program debug level is $Shell::POSIX::Select::U_WARN\n";
823 };
824 ; # NO DECLARATION OF LOOP-VAR REQUESTED # loop-var declaration appears here
825
826 ;
827 local (
828 $Shell::POSIX::Select::Prompt[6],
829 $Shell::POSIX::Select::menu
830 ) =
831 Shell::POSIX::Select::make_menu(
832 $Shell::POSIX::Select::Heading || "",
833 $Shell::POSIX::Select::Prompt || "" , # Might be overridden in make_menu
834 @Shell::POSIX::Select::looplist
835 );
836
837 # no point in prompting a pipe!
838 local $Shell::POSIX::Select::do_prompt[6] = (-t) ? 1 : 0 ;
839 0 > 2 and warn "do_prompt is $Shell::POSIX::Select::do_prompt[6]\n";
840 if ( defined $Shell::POSIX::Select::menu ) { # No list, no iterations!
841 while (1) { # for repeating prompt for selections
842 # localize, so I don't have to reset for
843 # outer loop on exit from inner
844 local ($Reply);
845 while (1) { # for validating user's input
846 local $Shell::POSIX::Select::bad = 0;
847
848 # local decl suppresses newline on prompt when -l switch turned on
849 {
850 local $\;
851 if ($Shell::POSIX::Select::do_prompt[6]) {
852
853 # When transferring from INNER to OUTER loop,
854 # extra NL before prompt is visually desirable
855
856 if ( $Shell::POSIX::Select::_extra_nl) {
857 print STDERR "\n\n";
858 $Shell::POSIX::Select::_extra_nl=0;
859 }
860 print STDERR
861 "$Shell::POSIX::Select::menu\n$Shell::POSIX::Select::Prompt[6] ";
862 }
863 }
864
865 # $Shell::POSIX::Select::do_prompt=0;
866 # constant prompting depends on style
867 $Shell::POSIX::Select::do_prompt[6]= 0;
868
869 if ( $Shell::POSIX::Select::dump_data ) {
870 $Reply = undef;
871 # dump filtered source for comparison against expected
872 print STDERR "copacetic
873 "; # ensure some output, and flush pending
874 exit 222; # code for graceful, expected, early exit
875 }
876 else {
877 # $^W=0;
878 # warn "Waiting for input";
879 $Eof=0;
880 $Reply = <STDIN>;
881 # warn "Got input";
882 # $^W=1;
883
884 if ( !defined( $Reply ) ) {
885 defined "" and "" ne "" and print STDERR "";
886
887 # need to undef loop var; user may check it!
888 undef $qq;
889
890 # last Shell::POSIX::Select::_SEL_LOOP6; # Syntax error!
891 # If returning to outer loop, show the prompt for it
892 # warn "User hit ^D";
893 if ( 6 > 1 and -t ) { # reset prompting for outer loop
894 $Shell::POSIX::Select::do_prompt[6-1] = 1; $Shell::POSIX::Select::_extra_nl=1;
895 }
896 0 > 2 and warn "Lasting out of _SEL_LOOP6\n";
897 $Eof=1;
898 last _SEL_LOOP6;
899 }
900 !defined $Reply and die "REPLY accessed, while undefined";
901 chomp $Reply;
902
903 # undo emboldening of user input
904 defined "" and "" ne "" and print STDERR "";
905
906 #print STDERR "$Shell::POSIX::Select::menu\n$Shell::POSIX::Select::Prompt ";
907 if ( $Reply eq "" ) { # interpreted as re-print menu request
908 # Empty input is legit, means redisplay menu
909 $Shell::POSIX::Select::U_WARN > 1 and warn "\tINPUT IS: empty\n";
910 $Shell::POSIX::Select::bad = $Shell::POSIX::Select::do_prompt[6] = 1;
911 }
912 elsif ( $Reply =~ /\D/ ) { # shouldn't be any non-digit!
913 $Shell::POSIX::Select::U_WARN > 0
914 and warn "\tINPUT CONTAINS NON-DIGIT: '$Reply'\n";
915 $Shell::POSIX::Select::bad = 1; # Korn and Bash shell just ignore this case
916 }
917 elsif ( $Reply < 1 or $Reply > $Shell::POSIX::Select::num_values ) {
918 $Shell::POSIX::Select::U_WARN > 0
919 and warn
920 "\t'$Reply' IS NOT IN RANGE: 1 - $Shell::POSIX::Select::num_values\n";
921 $Shell::POSIX::Select::bad = 1; # Korn and Bash shell just ignore this case
922 }
923
924 # warn "BAD is now: $Shell::POSIX::Select::bad";
925 $Shell::POSIX::Select::bad or
926 0 > 2 and warn "About to last out of Reply Validator Loop
927 ";
928 $Shell::POSIX::Select::bad or last; # REPLY VALIDATOR EXITED HERE
929 } # if for validating user input
930 } # infinite while for validating user input
931
932 $qq = $Shell::POSIX::Select::looplist[$Reply - 1]; # set users' variable
933
934 # USER'S LOOP-BLOCK BELOW
935 print "$qq\n";;
936
937 # USER'S LOOP-BLOCK ABOVE
938 # Making sure there's colon (maybe
939 # even two) after codestring above,
940 # in case user omitted after last
941 # statement in block. I might add
942 # another statement below it someday!
943 0 > 2 and warn "At end of prompt-repeating loop
944 ";
945 } # infinite while for repeating collection of selections
946 0 and warn "BEYOND end of prompt-repeating loop
947 ";
948 } # endif (defined $Shell::POSIX::Select::menu)
949 else {
950 $Shell::POSIX::Select::DEBUG > 0 and warn "Shell::POSIX::Select: Select Loop #6 has no list, so no iterations\n";
951
952 if ( $Shell::POSIX::Select::dump_data ) {
953 $Reply = undef;
954 # dump filtered source for comparison against expected
955 print STDERR "copacetic
956 "; # ensure some output, and flush pending
957 exit 222; # code for graceful, expected, early exit
958 }
959 }
960 # return omitted above, to get last expression's value
961 # returned automatically, just like shell's version
962
963
964 } # **** END NEW SCOPE FOR SELECTLOOP #6 ****
965 } # **** END WRAPPER SCOPE FOR SELECTLOOP #6 ****
966 # vi:ts=2 sw=2:
967
968
969 # Code generated by Shell::POSIX::Select v0.09, by tim(AT)TeachMePerl.com
970 # NOTA BENE: Line 1 of this segment must start with {, so user can LABEL it
971 { # **** NEW WRAPPER SCOPE FOR SELECTLOOP #7 ****
972 $Shell::POSIX::Select::DEBUG > 1 and 7 == 1 and
973 warn "LINE NUMBER FOR START OF USER CODE_BLOCK IS: ", __LINE__, "\n";
974 _SEL_LOOP7: { # **** NEW SCOPE FOR SELECTLOOP #7 ****
975
976 # critical for values's contents to be resolved in user's scope
977 local @Shell::POSIX::Select::looplist=(@ARGV);
978 local $Shell::POSIX::Select::num_values=@Shell::POSIX::Select::looplist;
979
980 $Shell::POSIX::Select::DEBUG > 4 and do {
981 warn "ARRAY VALUES ARE: @Shell::POSIX::Select::looplist\n";
982 warn "NUM VALUES is $Shell::POSIX::Select::num_values\n";
983 warn "user-program debug level is $Shell::POSIX::Select::U_WARN\n";
984 };
985 ; # NO DECLARATION OF LOOP-VAR REQUESTED # loop-var declaration appears here
986
987 ;
988 local (
989 $Shell::POSIX::Select::Prompt[7],
990 $Shell::POSIX::Select::menu
991 ) =
992 Shell::POSIX::Select::make_menu(
993 $Shell::POSIX::Select::Heading || "",
994 $Shell::POSIX::Select::Prompt || "" , # Might be overridden in make_menu
995 @Shell::POSIX::Select::looplist
996 );
997
998 # no point in prompting a pipe!
999 local $Shell::POSIX::Select::do_prompt[7] = (-t) ? 1 : 0 ;
1000 0 > 2 and warn "do_prompt is $Shell::POSIX::Select::do_prompt[7]\n";
1001 if ( defined $Shell::POSIX::Select::menu ) { # No list, no iterations!
1002 while (1) { # for repeating prompt for selections
1003 # localize, so I don't have to reset for
1004 # outer loop on exit from inner
1005 local ($Reply);
1006 while (1) { # for validating user's input
1007 local $Shell::POSIX::Select::bad = 0;
1008
1009 # local decl suppresses newline on prompt when -l switch turned on
1010 {
1011 local $\;
1012 if ($Shell::POSIX::Select::do_prompt[7]) {
1013
1014 # When transferring from INNER to OUTER loop,
1015 # extra NL before prompt is visually desirable
1016
1017 if ( $Shell::POSIX::Select::_extra_nl) {
1018 print STDERR "\n\n";
1019 $Shell::POSIX::Select::_extra_nl=0;
1020 }
1021 print STDERR
1022 "$Shell::POSIX::Select::menu\n$Shell::POSIX::Select::Prompt[7] ";
1023 }
1024 }
1025
1026 # $Shell::POSIX::Select::do_prompt=0;
1027 # constant prompting depends on style
1028 $Shell::POSIX::Select::do_prompt[7]= 0;
1029
1030 if ( $Shell::POSIX::Select::dump_data ) {
1031 $Reply = undef;
1032 # dump filtered source for comparison against expected
1033 print STDERR "copacetic
1034 "; # ensure some output, and flush pending
1035 exit 222; # code for graceful, expected, early exit
1036 }
1037 else {
1038 # $^W=0;
1039 # warn "Waiting for input";
1040 $Eof=0;
1041 $Reply = <STDIN>;
1042 # warn "Got input";
1043 # $^W=1;
1044
1045 if ( !defined( $Reply ) ) {
1046 defined "" and "" ne "" and print STDERR "";
1047
1048 # need to undef loop var; user may check it!
1049 undef $qw;
1050
1051 # last Shell::POSIX::Select::_SEL_LOOP7; # Syntax error!
1052 # If returning to outer loop, show the prompt for it
1053 # warn "User hit ^D";
1054 if ( 7 > 1 and -t ) { # reset prompting for outer loop
1055 $Shell::POSIX::Select::do_prompt[7-1] = 1; $Shell::POSIX::Select::_extra_nl=1;
1056 }
1057 0 > 2 and warn "Lasting out of _SEL_LOOP7\n";
1058 $Eof=1;
1059 last _SEL_LOOP7;
1060 }
1061 !defined $Reply and die "REPLY accessed, while undefined";
1062 chomp $Reply;
1063
1064 # undo emboldening of user input
1065 defined "" and "" ne "" and print STDERR "";
1066
1067 #print STDERR "$Shell::POSIX::Select::menu\n$Shell::POSIX::Select::Prompt ";
1068 if ( $Reply eq "" ) { # interpreted as re-print menu request
1069 # Empty input is legit, means redisplay menu
1070 $Shell::POSIX::Select::U_WARN > 1 and warn "\tINPUT IS: empty\n";
1071 $Shell::POSIX::Select::bad = $Shell::POSIX::Select::do_prompt[7] = 1;
1072 }
1073 elsif ( $Reply =~ /\D/ ) { # shouldn't be any non-digit!
1074 $Shell::POSIX::Select::U_WARN > 0
1075 and warn "\tINPUT CONTAINS NON-DIGIT: '$Reply'\n";
1076 $Shell::POSIX::Select::bad = 1; # Korn and Bash shell just ignore this case
1077 }
1078 elsif ( $Reply < 1 or $Reply > $Shell::POSIX::Select::num_values ) {
1079 $Shell::POSIX::Select::U_WARN > 0
1080 and warn
1081 "\t'$Reply' IS NOT IN RANGE: 1 - $Shell::POSIX::Select::num_values\n";
1082 $Shell::POSIX::Select::bad = 1; # Korn and Bash shell just ignore this case
1083 }
1084
1085 # warn "BAD is now: $Shell::POSIX::Select::bad";
1086 $Shell::POSIX::Select::bad or
1087 0 > 2 and warn "About to last out of Reply Validator Loop
1088 ";
1089 $Shell::POSIX::Select::bad or last; # REPLY VALIDATOR EXITED HERE
1090 } # if for validating user input
1091 } # infinite while for validating user input
1092
1093 $qw = $Shell::POSIX::Select::looplist[$Reply - 1]; # set users' variable
1094
1095 # USER'S LOOP-BLOCK BELOW
1096 print "$qw\n";;
1097
1098 # USER'S LOOP-BLOCK ABOVE
1099 # Making sure there's colon (maybe
1100 # even two) after codestring above,
1101 # in case user omitted after last
1102 # statement in block. I might add
1103 # another statement below it someday!
1104 0 > 2 and warn "At end of prompt-repeating loop
1105 ";
1106 } # infinite while for repeating collection of selections
1107 0 and warn "BEYOND end of prompt-repeating loop
1108 ";
1109 } # endif (defined $Shell::POSIX::Select::menu)
1110 else {
1111 $Shell::POSIX::Select::DEBUG > 0 and warn "Shell::POSIX::Select: Select Loop #7 has no list, so no iterations\n";
1112
1113 if ( $Shell::POSIX::Select::dump_data ) {
1114 $Reply = undef;
1115 # dump filtered source for comparison against expected
1116 print STDERR "copacetic
1117 "; # ensure some output, and flush pending
1118 exit 222; # code for graceful, expected, early exit
1119 }
1120 }
1121 # return omitted above, to get last expression's value
1122 # returned automatically, just like shell's version
1123
1124
1125 } # **** END NEW SCOPE FOR SELECTLOOP #7 ****
1126 } # **** END WRAPPER SCOPE FOR SELECTLOOP #7 ****
1127 # vi:ts=2 sw=2:
1128
1129
1130 # Code generated by Shell::POSIX::Select v0.09, by tim(AT)TeachMePerl.com
1131 # NOTA BENE: Line 1 of this segment must start with {, so user can LABEL it
1132 { # **** NEW WRAPPER SCOPE FOR SELECTLOOP #8 ****
1133 $Shell::POSIX::Select::DEBUG > 1 and 8 == 1 and
1134 warn "LINE NUMBER FOR START OF USER CODE_BLOCK IS: ", __LINE__, "\n";
1135 _SEL_LOOP8: { # **** NEW SCOPE FOR SELECTLOOP #8 ****
1136
1137 # critical for values's contents to be resolved in user's scope
1138 local @Shell::POSIX::Select::looplist=(@ARGV);
1139 local $Shell::POSIX::Select::num_values=@Shell::POSIX::Select::looplist;
1140
1141 $Shell::POSIX::Select::DEBUG > 4 and do {
1142 warn "ARRAY VALUES ARE: @Shell::POSIX::Select::looplist\n";
1143 warn "NUM VALUES is $Shell::POSIX::Select::num_values\n";
1144 warn "user-program debug level is $Shell::POSIX::Select::U_WARN\n";
1145 };
1146 ; # NO DECLARATION OF LOOP-VAR REQUESTED # loop-var declaration appears here
1147
1148 ;
1149 local (
1150 $Shell::POSIX::Select::Prompt[8],
1151 $Shell::POSIX::Select::menu
1152 ) =
1153 Shell::POSIX::Select::make_menu(
1154 $Shell::POSIX::Select::Heading || "",
1155 $Shell::POSIX::Select::Prompt || "" , # Might be overridden in make_menu
1156 @Shell::POSIX::Select::looplist
1157 );
1158
1159 # no point in prompting a pipe!
1160 local $Shell::POSIX::Select::do_prompt[8] = (-t) ? 1 : 0 ;
1161 0 > 2 and warn "do_prompt is $Shell::POSIX::Select::do_prompt[8]\n";
1162 if ( defined $Shell::POSIX::Select::menu ) { # No list, no iterations!
1163 while (1) { # for repeating prompt for selections
1164 # localize, so I don't have to reset for
1165 # outer loop on exit from inner
1166 local ($Reply);
1167 while (1) { # for validating user's input
1168 local $Shell::POSIX::Select::bad = 0;
1169
1170 # local decl suppresses newline on prompt when -l switch turned on
1171 {
1172 local $\;
1173 if ($Shell::POSIX::Select::do_prompt[8]) {
1174
1175 # When transferring from INNER to OUTER loop,
1176 # extra NL before prompt is visually desirable
1177
1178 if ( $Shell::POSIX::Select::_extra_nl) {
1179 print STDERR "\n\n";
1180 $Shell::POSIX::Select::_extra_nl=0;
1181 }
1182 print STDERR
1183 "$Shell::POSIX::Select::menu\n$Shell::POSIX::Select::Prompt[8] ";
1184 }
1185 }
1186
1187 # $Shell::POSIX::Select::do_prompt=0;
1188 # constant prompting depends on style
1189 $Shell::POSIX::Select::do_prompt[8]= 0;
1190
1191 if ( $Shell::POSIX::Select::dump_data ) {
1192 $Reply = undef;
1193 # dump filtered source for comparison against expected
1194 print STDERR "copacetic
1195 "; # ensure some output, and flush pending
1196 exit 222; # code for graceful, expected, early exit
1197 }
1198 else {
1199 # $^W=0;
1200 # warn "Waiting for input";
1201 $Eof=0;
1202 $Reply = <STDIN>;
1203 # warn "Got input";
1204 # $^W=1;
1205
1206 if ( !defined( $Reply ) ) {
1207 defined "" and "" ne "" and print STDERR "";
1208
1209 # need to undef loop var; user may check it!
1210 undef $qr;
1211
1212 # last Shell::POSIX::Select::_SEL_LOOP8; # Syntax error!
1213 # If returning to outer loop, show the prompt for it
1214 # warn "User hit ^D";
1215 if ( 8 > 1 and -t ) { # reset prompting for outer loop
1216 $Shell::POSIX::Select::do_prompt[8-1] = 1; $Shell::POSIX::Select::_extra_nl=1;
1217 }
1218 0 > 2 and warn "Lasting out of _SEL_LOOP8\n";
1219 $Eof=1;
1220 last _SEL_LOOP8;
1221 }
1222 !defined $Reply and die "REPLY accessed, while undefined";
1223 chomp $Reply;
1224
1225 # undo emboldening of user input
1226 defined "" and "" ne "" and print STDERR "";
1227
1228 #print STDERR "$Shell::POSIX::Select::menu\n$Shell::POSIX::Select::Prompt ";
1229 if ( $Reply eq "" ) { # interpreted as re-print menu request
1230 # Empty input is legit, means redisplay menu
1231 $Shell::POSIX::Select::U_WARN > 1 and warn "\tINPUT IS: empty\n";
1232 $Shell::POSIX::Select::bad = $Shell::POSIX::Select::do_prompt[8] = 1;
1233 }
1234 elsif ( $Reply =~ /\D/ ) { # shouldn't be any non-digit!
1235 $Shell::POSIX::Select::U_WARN > 0
1236 and warn "\tINPUT CONTAINS NON-DIGIT: '$Reply'\n";
1237 $Shell::POSIX::Select::bad = 1; # Korn and Bash shell just ignore this case
1238 }
1239 elsif ( $Reply < 1 or $Reply > $Shell::POSIX::Select::num_values ) {
1240 $Shell::POSIX::Select::U_WARN > 0
1241 and warn
1242 "\t'$Reply' IS NOT IN RANGE: 1 - $Shell::POSIX::Select::num_values\n";
1243 $Shell::POSIX::Select::bad = 1; # Korn and Bash shell just ignore this case
1244 }
1245
1246 # warn "BAD is now: $Shell::POSIX::Select::bad";
1247 $Shell::POSIX::Select::bad or
1248 0 > 2 and warn "About to last out of Reply Validator Loop
1249 ";
1250 $Shell::POSIX::Select::bad or last; # REPLY VALIDATOR EXITED HERE
1251 } # if for validating user input
1252 } # infinite while for validating user input
1253
1254 $qr = $Shell::POSIX::Select::looplist[$Reply - 1]; # set users' variable
1255
1256 # USER'S LOOP-BLOCK BELOW
1257 print "$qr\n";;
1258
1259 # USER'S LOOP-BLOCK ABOVE
1260 # Making sure there's colon (maybe
1261 # even two) after codestring above,
1262 # in case user omitted after last
1263 # statement in block. I might add
1264 # another statement below it someday!
1265 0 > 2 and warn "At end of prompt-repeating loop
1266 ";
1267 } # infinite while for repeating collection of selections
1268 0 and warn "BEYOND end of prompt-repeating loop
1269 ";
1270 } # endif (defined $Shell::POSIX::Select::menu)
1271 else {
1272 $Shell::POSIX::Select::DEBUG > 0 and warn "Shell::POSIX::Select: Select Loop #8 has no list, so no iterations\n";
1273
1274 if ( $Shell::POSIX::Select::dump_data ) {
1275 $Reply = undef;
1276 # dump filtered source for comparison against expected
1277 print STDERR "copacetic
1278 "; # ensure some output, and flush pending
1279 exit 222; # code for graceful, expected, early exit
1280 }
1281 }
1282 # return omitted above, to get last expression's value
1283 # returned automatically, just like shell's version
1284
1285
1286 } # **** END NEW SCOPE FOR SELECTLOOP #8 ****
1287 } # **** END WRAPPER SCOPE FOR SELECTLOOP #8 ****
1288 # vi:ts=2 sw=2:
1289
1290
1291 # Code generated by Shell::POSIX::Select v0.09, by tim(AT)TeachMePerl.com
1292 # NOTA BENE: Line 1 of this segment must start with {, so user can LABEL it
1293 { # **** NEW WRAPPER SCOPE FOR SELECTLOOP #9 ****
1294 $Shell::POSIX::Select::DEBUG > 1 and 9 == 1 and
1295 warn "LINE NUMBER FOR START OF USER CODE_BLOCK IS: ", __LINE__, "\n";
1296 _SEL_LOOP9: { # **** NEW SCOPE FOR SELECTLOOP #9 ****
1297
1298 # critical for values's contents to be resolved in user's scope
1299 local @Shell::POSIX::Select::looplist=(@ARGV);
1300 local $Shell::POSIX::Select::num_values=@Shell::POSIX::Select::looplist;
1301
1302 $Shell::POSIX::Select::DEBUG > 4 and do {
1303 warn "ARRAY VALUES ARE: @Shell::POSIX::Select::looplist\n";
1304 warn "NUM VALUES is $Shell::POSIX::Select::num_values\n";
1305 warn "user-program debug level is $Shell::POSIX::Select::U_WARN\n";
1306 };
1307 ; # NO DECLARATION OF LOOP-VAR REQUESTED # loop-var declaration appears here
1308
1309 ;
1310 local (
1311 $Shell::POSIX::Select::Prompt[9],
1312 $Shell::POSIX::Select::menu
1313 ) =
1314 Shell::POSIX::Select::make_menu(
1315 $Shell::POSIX::Select::Heading || "",
1316 $Shell::POSIX::Select::Prompt || "" , # Might be overridden in make_menu
1317 @Shell::POSIX::Select::looplist
1318 );
1319
1320 # no point in prompting a pipe!
1321 local $Shell::POSIX::Select::do_prompt[9] = (-t) ? 1 : 0 ;
1322 0 > 2 and warn "do_prompt is $Shell::POSIX::Select::do_prompt[9]\n";
1323 if ( defined $Shell::POSIX::Select::menu ) { # No list, no iterations!
1324 while (1) { # for repeating prompt for selections
1325 # localize, so I don't have to reset for
1326 # outer loop on exit from inner
1327 local ($Reply);
1328 while (1) { # for validating user's input
1329 local $Shell::POSIX::Select::bad = 0;
1330
1331 # local decl suppresses newline on prompt when -l switch turned on
1332 {
1333 local $\;
1334 if ($Shell::POSIX::Select::do_prompt[9]) {
1335
1336 # When transferring from INNER to OUTER loop,
1337 # extra NL before prompt is visually desirable
1338
1339 if ( $Shell::POSIX::Select::_extra_nl) {
1340 print STDERR "\n\n";
1341 $Shell::POSIX::Select::_extra_nl=0;
1342 }
1343 print STDERR
1344 "$Shell::POSIX::Select::menu\n$Shell::POSIX::Select::Prompt[9] ";
1345 }
1346 }
1347
1348 # $Shell::POSIX::Select::do_prompt=0;
1349 # constant prompting depends on style
1350 $Shell::POSIX::Select::do_prompt[9]= 0;
1351
1352 if ( $Shell::POSIX::Select::dump_data ) {
1353 $Reply = undef;
1354 # dump filtered source for comparison against expected
1355 print STDERR "copacetic
1356 "; # ensure some output, and flush pending
1357 exit 222; # code for graceful, expected, early exit
1358 }
1359 else {
1360 # $^W=0;
1361 # warn "Waiting for input";
1362 $Eof=0;
1363 $Reply = <STDIN>;
1364 # warn "Got input";
1365 # $^W=1;
1366
1367 if ( !defined( $Reply ) ) {
1368 defined "" and "" ne "" and print STDERR "";
1369
1370 # need to undef loop var; user may check it!
1371 undef $qx;
1372
1373 # last Shell::POSIX::Select::_SEL_LOOP9; # Syntax error!
1374 # If returning to outer loop, show the prompt for it
1375 # warn "User hit ^D";
1376 if ( 9 > 1 and -t ) { # reset prompting for outer loop
1377 $Shell::POSIX::Select::do_prompt[9-1] = 1; $Shell::POSIX::Select::_extra_nl=1;
1378 }
1379 0 > 2 and warn "Lasting out of _SEL_LOOP9\n";
1380 $Eof=1;
1381 last _SEL_LOOP9;
1382 }
1383 !defined $Reply and die "REPLY accessed, while undefined";
1384 chomp $Reply;
1385
1386 # undo emboldening of user input
1387 defined "" and "" ne "" and print STDERR "";
1388
1389 #print STDERR "$Shell::POSIX::Select::menu\n$Shell::POSIX::Select::Prompt ";
1390 if ( $Reply eq "" ) { # interpreted as re-print menu request
1391 # Empty input is legit, means redisplay menu
1392 $Shell::POSIX::Select::U_WARN > 1 and warn "\tINPUT IS: empty\n";
1393 $Shell::POSIX::Select::bad = $Shell::POSIX::Select::do_prompt[9] = 1;
1394 }
1395 elsif ( $Reply =~ /\D/ ) { # shouldn't be any non-digit!
1396 $Shell::POSIX::Select::U_WARN > 0
1397 and warn "\tINPUT CONTAINS NON-DIGIT: '$Reply'\n";
1398 $Shell::POSIX::Select::bad = 1; # Korn and Bash shell just ignore this case
1399 }
1400 elsif ( $Reply < 1 or $Reply > $Shell::POSIX::Select::num_values ) {
1401 $Shell::POSIX::Select::U_WARN > 0
1402 and warn
1403 "\t'$Reply' IS NOT IN RANGE: 1 - $Shell::POSIX::Select::num_values\n";
1404 $Shell::POSIX::Select::bad = 1; # Korn and Bash shell just ignore this case
1405 }
1406
1407 # warn "BAD is now: $Shell::POSIX::Select::bad";
1408 $Shell::POSIX::Select::bad or
1409 0 > 2 and warn "About to last out of Reply Validator Loop
1410 ";
1411 $Shell::POSIX::Select::bad or last; # REPLY VALIDATOR EXITED HERE
1412 } # if for validating user input
1413 } # infinite while for validating user input
1414
1415 $qx = $Shell::POSIX::Select::looplist[$Reply - 1]; # set users' variable
1416
1417 # USER'S LOOP-BLOCK BELOW
1418 print "$qx\n";;
1419
1420 # USER'S LOOP-BLOCK ABOVE
1421 # Making sure there's colon (maybe
1422 # even two) after codestring above,
1423 # in case user omitted after last
1424 # statement in block. I might add
1425 # another statement below it someday!
1426 0 > 2 and warn "At end of prompt-repeating loop
1427 ";
1428 } # infinite while for repeating collection of selections
1429 0 and warn "BEYOND end of prompt-repeating loop
1430 ";
1431 } # endif (defined $Shell::POSIX::Select::menu)
1432 else {
1433 $Shell::POSIX::Select::DEBUG > 0 and warn "Shell::POSIX::Select: Select Loop #9 has no list, so no iterations\n";
1434
1435 if ( $Shell::POSIX::Select::dump_data ) {
1436 $Reply = undef;
1437 # dump filtered source for comparison against expected
1438 print STDERR "copacetic
1439 "; # ensure some output, and flush pending
1440 exit 222; # code for graceful, expected, early exit
1441 }
1442 }
1443 # return omitted above, to get last expression's value
1444 # returned automatically, just like shell's version
1445
1446
1447 } # **** END NEW SCOPE FOR SELECTLOOP #9 ****
1448 } # **** END WRAPPER SCOPE FOR SELECTLOOP #9 ****
1449 # vi:ts=2 sw=2:
1450