PilotinControl has asked for the wisdom of the Perl Monks concerning the following question:
Good Morning Esteemed Monks!
What I would like is a pure perl solution in splitting the screen as shown in the code below. Top of the screen shows all the information and at the bottom of the screen is where new values can be entered. I would like the top screen to be shown all the time and the bottom screen changes for each input that needs to be changed. In this case the only value that needs changed is Owner. Thanks in advance.
#!/usr/bin/perl use strict; use warnings; use diagnostics; use Win32::Console::ANSI; use Win32::Console; use Term::ANSIColor; use Term::ANSIScreen qw/:cursor :screen/; ################### # # TEST ONLY # ################### Title "Edit Car"; open(MYINPUTFILE, "cardata.txt"); # open for input $| = 1; my @lines = <MYINPUTFILE>; # read file into list close (MYINPUTFILE); printf ("|VERIFY CAR OWNER|\n\n"); my $carownerverify = <STDIN>; $carownerverify = <STDIN> until defined $carownerverify; chomp($carownerverify); cls(); printf ("| OWNER | MAKE | MODEL | YEAR |\n\n"); my $found = 0; foreach my $carownerverify2 (@lines) { my @field = split(':',$carownerverify2); if ($field[0] =~ /(?<![\w-])$carownerverify(?![\w-])/i) { my $format = " %-13s %-15s %-11s %0s\n"; printf ($format, $field[0], $field[1], $field[2], $field[3]); $found =1; } } # END FILE LOOP ######################################### # # THE ABOVE STAYS ON TOP OF THE SCREEN # THE BELOW IS WHAT CHANGES # ######################################### print("| OWNER: |\n\n"); my $origOwner = <STDIN>; $origOwner = <STDIN> until defined $origOwner; chomp $origOwner; cls(); print("| NEW OWNER: |\n\n"); my $newOwner = <STDIN>; $newOwner = <STDIN> until defined $newOwner; chomp $newOwner; cls(); my $file = "cardata.txt"; local $^I = ".bak"; local @ARGV = ($file); while (<>) { chomp; my ($Owner,$Make,$Model,$Year) = split(/\:/); if ($Owner eq $origOwner) { print "$Owner:$Make:$Model:$Year:$newOwner\n"; } else { print "$_\n"; } } unlink("$file.bak"); #close $file; print("CAR UPDATED SUCCESSFULLY!!\n\n"); sleep 10;
|
|---|
| Replies are listed 'Best First'. | |
|---|---|
|
Re: Pure Perl Split Screen
by blindluke (Hermit) on Nov 10, 2014 at 17:05 UTC | |
by GotToBTru (Prior) on Nov 10, 2014 at 17:32 UTC | |
by PilotinControl (Pilgrim) on Nov 10, 2014 at 19:15 UTC | |
by blindluke (Hermit) on Nov 10, 2014 at 21:54 UTC | |
by PilotinControl (Pilgrim) on Nov 10, 2014 at 23:44 UTC | |
by GotToBTru (Prior) on Nov 10, 2014 at 19:25 UTC | |
by PilotinControl (Pilgrim) on Nov 10, 2014 at 19:49 UTC | |
by PilotinControl (Pilgrim) on Nov 10, 2014 at 17:17 UTC | |
by soonix (Chancellor) on Nov 11, 2014 at 07:28 UTC | |
by PilotinControl (Pilgrim) on Nov 15, 2014 at 14:16 UTC | |
by blindluke (Hermit) on Nov 17, 2014 at 14:59 UTC | |
by PilotinControl (Pilgrim) on Nov 17, 2014 at 19:06 UTC | |
|
Re: Pure Perl Split Screen
by fishmonger (Chaplain) on Nov 10, 2014 at 17:38 UTC | |
by PilotinControl (Pilgrim) on Nov 10, 2014 at 20:23 UTC | |
|
Re: Pure Perl Split Screen
by Discipulus (Canon) on Nov 11, 2014 at 08:28 UTC | |
by PilotinControl (Pilgrim) on Nov 11, 2014 at 12:34 UTC |