+ if ($command =~ /\[\@--/) { # Use Text::Template
+
+ my $template_data = {};
+
+ if ($action eq 'replace') {
+ $template_data->{"old_$_"} = $old->getfield($_) foreach $old->fields;
+ $template_data->{"new_$_"} = $svc_broadband->getfield($_)
+ foreach $svc_broadband->fields;
+ } else {
+ $template_data->{$_} = $svc_broadband->getfield($_)
+ foreach $svc_broadband->fields;
+ }
+
+ my $template = new Text::Template (
+ TYPE => 'STRING',
+ SOURCE => $command,
+ DELIMITERS => [ '[@--', '--@]' ],
+ ) or return "Unable to construct template for router command: "
+ . $Text::Template::ERROR;
+
+ $command = $template->fill_in(
+ HASH => $template_data,
+ BROKEN_ARG => \$error,
+ BROKEN => sub {
+ my %bargs = @_;
+ my $err = $bargs{'arg'};
+ $$err = $bargs{'error'};
+ return undef;
+ },
+ );
+
+ if (not defined $command or $error) {
+ $error ||= $Text::Template::ERROR;
+ return "Unable to fill-in template for router command: $error";
+ }
+
+ } else { # Use eval