ok. I figured out that giving Input_log => \*STDOUT works and it gives the correct output as desired. But the $t->cmd() doesn't work for certain commands. Like for ls, whoami it works, but for certain commands which change the command prompt, it doesn't work, like setting a clearcase view, anybody has any idea ? thanks.
On Aug 5, 2:52 pm, [EMAIL PROTECTED] (Hashmat Khan) wrote: > Hello Rob, > > Thanks for the reply. > Yes, I am using Net::Telnet. And I am new to perl, I was not aware if there > are other methods to start telnet using perl. > I did as you suggested. It worked but not completely as I wanted the output. > use Net::Telnet (); > $t = new Net::Telnet (Timeout => 10, > Prompt => $prompt, > Dump_Log => \*STDOUT); > > What is this \* used for ? Previoulsy I tried with only STDOUT and it hadn't > worked. > > Basically I am looking for an output that would come as if for example I had > used windows telnet to login to some server. > In this output, first I see hex output too. Secondly, I don't see the prompt > after executing each command. Thirdly, I don't see the output for the > commands, like I used 'ls'. And I am using: > $t->print("ls"); I am not using cmd as it timeout for some of the > commands. > > So I want to print all the input provided in the script and all the output. > > Thanks, > Hashmat > > On Tue, Aug 5, 2008 at 4:57 AM, Rob Dixon <[EMAIL PROTECTED]> wrote: > > Hashmat Khan wrote: > > > > Has anybody used Telnet ? > > > > I want to know, how can we redirect the output to STDOUT instead of > > > log file ? (Dump_Log => "dump.txt") > > > It's important to tell us exactly what module you're using. Telnet is a > > comms > > protocol but I don't think you mean that. There is no Perl module called > > Telnet > > but there are many with Telnet in the name. I assume you're using > > Net::Telnet as > > it has a Dump_Log parameter to the constructor method, but it would have > > been > > much better if you'd said so. > > > I haven't used the module, but the documentation says that the dump_log > > method > > will accept an open file handle as well as a file name so > > > $object->dump_log(\*STDOUT); > > > should work. It should also be OK to put it as a parameter to the > > constructor as in > > > my $object = Net::Telnet->new(Dump_Log => \*STDOUT); > > > if you'd rather do it like that. Give it a try and see. > > > HTH, > > > Rob -- To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED] http://learn.perl.org/