CGI/Perl Guide | Learning Center | Forums | Advertise | Login
Site Search: in

  Main Index MAIN
INDEX
Search Posts SEARCH
POSTS
Who's Online WHO'S
ONLINE
Log in LOG
IN

Home: Perl Programming Help: Intermediate:
Can there be multiple operators for a telnet prompt?

 



cuboidgraphix
User

Oct 12, 2011, 1:57 PM

Post #1 of 2 (715 views)
Can there be multiple operators for a telnet prompt? Can't Post

Hi guys,
I'm trying to write a telnet script that will send commands whenever it prompts different operators. Is this possible? For example...


Code
my $t = new Net::Telnet(Timeout=>10,  
Errmode=>'die',
Prompt=>'/---/');


I would like to run a command whenever I'm prompted with a '%' or a '>'. How can I included these two operators in my code? I appreciate any help offered.

Thanks.


rovf
Veteran

Oct 14, 2011, 1:23 AM

Post #2 of 2 (699 views)
Re: [cuboidgraphix] Can there be multiple operators for a telnet prompt? [In reply to] Can't Post


Quote
whenever it prompts different operators


????

I guess you mean "prompting characters", whenever you say "operators".

The argument to "Prompt" is a regexp, so you can define whatever your prompt may look light.

Further, note that perldoc Net::Telnet says:



Quote
The default Prompt is '/[\$%#>] $/'



So the default already includes % and >. If this is to coarse-grained, you can, of course, refine this.

 
 


Search for (options) Powered by Gossamer Forum v.1.2.0

Web Applications & Managed Hosting Powered by Gossamer Threads
Visit our Mailing List Archives