Cisco-CopyConfig

 view release on metacpan or  search on metacpan

CopyConfig.pm  view on Meta::CPAN

    $copy_f	= 'lab-router-a.config';
    $host	= 'lab-router-a';
    $comm	= 'public';
    $config	= Cisco::CopyConfig->new(
		     Host => $host,
		     Comm => $comm
    );
    $path	= "/tftpboot/${copy_f}"; 

    open(COPY_FH, "> $path") || die $!;
    close(COPY_FH); chmod 0666, $path || die $!;

    print "${tftp}:${merge_f} -> ${host}:running-config... ";
    if ($config->merge($tftp, $merge_f)) {  # merge the new config
      print "OK\n";
    } else {
      die $config->error();
    }
    print "${host}:running-config -> ${tftp}:${copy_f}... ";
    if ($config->copy($tftp, $copy_f)) {    # copy the updated config
      print "OK\n";



( run in 0.288 second using v1.01-cache-2.11-cpan-496ff517765 )