Perhaps that data contains '<<<<<' in it already?

Try 
  print "--->>>>$line\<<<<---\n";
Just in case it's seeing it as a varaible named 'line<..'
That could cause all sorts of screwy ness

For kicks what does it ouput if you do :

 print "\n---- start line ---- \n $line \n---- end line ---- \n"; 


Dan

-----Original Message-----
From: Jason Frisvold [mailto:[EMAIL PROTECTED]] 
Sent: Wednesday, January 08, 2003 1:39 PM
To: Perl Beginners List
Subject: "hidden" characters in an input stream


Hi all,

        I'm using the Net::Telnet module to automate some of the more menial tasks I 
have to deal with every so often.  Part of the task requires parsing a stream of data 
from the device I'm telnetting to (A Marconi ASX-200 to be exact) ...  I've 
successfully set up the telnet, logged in, and executed the proper commands.  Now, 
however, I need to retrieve data from the device.  I can submit the command and use 
getline() to retrieve lines, one at a time, and parse it.  However, there are "hidden" 
characters here and I don't know how to determine what they are.

Here is a quick snippet of the code :

$Telnet->print("sec log sho");
while (my $line = $Telnet->getline(Timeout => 5,)) {
        chomp $line;
        print "--->>>>$line<<<<---\n";
}

This should simple print out each line with the arrows before and after the line.  
However, upon output, I get something like the following :

--->>>> sec log sho<<<<---
UserName               Application  Authentication Method  Profile
Name<<<<---
---------------------  -----------  --------------------- 
--------------------<<<<---
myuser                 console      password               admin<<<<---
myuser                 http         password               admin<<<<---
myuser                 telnet       password               admin<<<<---


I'm guessing this is a carriage return character?  I believe that's the one that 
causes the output to start at the beginning of the line.

Does anyone know how I can properly remove these characters so I can parse this 
information?

In addition, is using the timeout on getline the "proper" way to determine that the 
input stream has stopped?

Thanks,


-- 
---------------------------
Jason H. Frisvold
Backbone Engineer
Penteledata Engineering
[EMAIL PROTECTED]
RedHat Certified - RHCE # 807302349405893
---------------------------
"Something mysterious is formed, born in the silent void. Waiting alone and unmoving, 
it is at once still and yet in constant motion. It is the source of all programs. I do 
not know its name, so I will call it the Tao of Programming."

--
To unsubscribe, e-mail: [EMAIL PROTECTED]
For additional commands, e-mail: [EMAIL PROTECTED]

Reply via email to