silentreproach
asked on
Debug plain text input
My script's purpose is to perform .NET functions on a PC client, and it talks back and forth using plain text:
a) The script prints plain text, which is intercepted by the client and tells the client which .NET operations to perform (this part is working great).
b) The Windows client (basically a glorified telnet client) sends responses in plain text back to the perl script (with perhaps a CR/LF after each line of text - maybe this is the problem)
The only line that is giving me trouble is the one exiting the loop:
last if $text eq '3Click,MyForm.button1';
The script exits correctly if i manually run it from the # prompt and type:
3Click,MyForm.button1
followed by pressing the ENTER key.
The problem is the script does not end when my client sends this text. Are there alternatives to chomp that I should be using? To debug, is there a way I can dump the value of $text into a file during each pass through the loop, so I can see what text the script is receiving? Or is my syntax just inappropriate for the application?
The script:
#!/usr/bin/perl
# Enter TrueGUI mode:
print "\$\$EnterTrueGuiMode\$\$\ n";
# Load the set of Windows Forms we created with Visual Studio:
print "{ TrueGui.LoadAssembly(`Wind owsApplica tion1`) }\n";
# Create an instance of Form1 calling it "MyForm"
print "{ MyForm = New WindowsApplication1.Form1( ) }\n";
# Show MyForm
print "{ MyForm.Show() }\n";
while(1) {
$text=<STDIN>;
chomp($text);
last if $text eq '3Click,MyForm.button1';
}
# end of script
Thanks,
Andrew
a) The script prints plain text, which is intercepted by the client and tells the client which .NET operations to perform (this part is working great).
b) The Windows client (basically a glorified telnet client) sends responses in plain text back to the perl script (with perhaps a CR/LF after each line of text - maybe this is the problem)
The only line that is giving me trouble is the one exiting the loop:
last if $text eq '3Click,MyForm.button1';
The script exits correctly if i manually run it from the # prompt and type:
3Click,MyForm.button1
followed by pressing the ENTER key.
The problem is the script does not end when my client sends this text. Are there alternatives to chomp that I should be using? To debug, is there a way I can dump the value of $text into a file during each pass through the loop, so I can see what text the script is receiving? Or is my syntax just inappropriate for the application?
The script:
#!/usr/bin/perl
# Enter TrueGUI mode:
print "\$\$EnterTrueGuiMode\$\$\
# Load the set of Windows Forms we created with Visual Studio:
print "{ TrueGui.LoadAssembly(`Wind
# Create an instance of Form1 calling it "MyForm"
print "{ MyForm = New WindowsApplication1.Form1(
# Show MyForm
print "{ MyForm.Show() }\n";
while(1) {
$text=<STDIN>;
chomp($text);
last if $text eq '3Click,MyForm.button1';
}
# end of script
Thanks,
Andrew
ASKER CERTIFIED SOLUTION
membership
This solution is only available to members.
To access this solution, you must be a member of Experts Exchange.
SOLUTION
membership
This solution is only available to members.
To access this solution, you must be a member of Experts Exchange.