amt has asked for the wisdom of the Perl Monks concerning the following question:

I'm trying to update a Cisco router through a web form. Here is the code that I have:
sub update_router_config { if( $cisco->enable("$enable_password")){ $cisco->cmd("config t"); # enter new configuration $cisco->print("@conf"); # send new data for config } }
That is to replace the direct Cisco codes of:
>enable #config t # <pasting of configuration> < end #copy run start
I have posted this question before, but it seems that I have found the real problem. The problem is that I don't seem to be exiting the configure mode. The input contains the 'end' keyword to exit the configuration mode. And even when I remove the 'copy run start' (because it prompts), I can't even get the plain running configuration to show up in the reloaded page. The textarea simply appears empty when returning to the page.
amt

Replies are listed 'Best First'.
Re: Net::Telnet::Cisco Updating Configuration
by vladdrak (Monk) on Aug 13, 2004 at 18:49 UTC
    You can just use 'exit' instead of of a CTRL-Z.
    sub update_router_config { if( $cisco->enable("$enable_password")){ $cisco->cmd("config t"); # enter new configuration $cisco->put("$conf"); # send new data for config $cisco->cmd("exit"); # end new data $cisco->cmd("copy run start"); # enable new config } }
    -Vlad
Re: Net::Telnet::Cisco Updating Configuration
by Anonymous Monk on Aug 13, 2004 at 17:42 UTC
    $cisco->put( "\cZ" );?