+
+ if (not defined $command or $error) {
+ $error ||= $Text::Template::ERROR;
+ return "Unable to fill-in template for router command: $error";
+ }
+
+ } else { # Use eval
+ no strict 'vars';
+ no strict 'refs';
+
+ if ($action eq 'replace') {
+ ${"old_$_"} = $old->getfield($_) foreach $old->fields;
+ ${"new_$_"} = $svc_broadband->getfield($_) foreach $svc_broadband->fields;
+ $command = eval(qq("$command"));
+ } else {
+ ${$_} = $svc_broadband->getfield($_) foreach $svc_broadband->fields;
+ $command = eval(qq("$command"));
+ }
+ return $@ if $@;
+ }
+
+ my $args = [
+ 'user' => $router->getfield($field_prefix . '_user'),
+ 'password' => $router->getfield($field_prefix . '_password'),
+ 'host' => $router->getfield($field_prefix . '_address'),
+ 'Timeout' => $router->getfield($field_prefix . '_timeout'),
+ 'Prompt' => $router->getfield($field_prefix . '_prompt'),
+ 'command' => $command,
+ ];
+
+ my $error_check = $router->getfield("${field_prefix}_cmd_${action}_error");
+ push(@$args, ('error_check' => $error_check)) if ($error_check);
+
+ return('', $args);
+
+}
+
+sub _get_cmd_sub {
+
+ my ($self, $svc_broadband, $router) = (shift, shift, shift);
+
+ my $protocol = (
+ $router->getfield($self->_field_prefix . '_protocol') =~ /^(telnet|ssh)$/
+ ) ? $1 : 'telnet';
+
+ return(ref($self)."::".$protocol."_cmd");
+
+}
+
+sub _check_router_fields {
+
+ my ($self, $router, $action) = (shift, shift, shift);
+ my @check_fields = $self->_req_router_fields;
+
+ foreach (@check_fields) {
+ if ($router->getfield($_) eq '') {
+ warn "[debug]$me Required field '$_' is unset" if $DEBUG;
+ return 0;
+ } else {
+ return 1;
+ }