+sub _substitute {
+ my ($self, $string, @objects) = @_;
+ return '' unless $string;
+ foreach my $object (@objects) {
+ next unless $object;
+ foreach my $field ($object->fields) {
+ next unless $field;
+ my $value = $object->get($field);
+ $string =~ s/\$$field/$value/g;
+ }
+ }
+ # strip leading/trailing whitespace
+ $string =~ s/^\s//g;
+ $string =~ s/\s$//g;
+ return $string;
+}
+
+=head2 portaone_customer_name
+
+Accepts I<$cust_main> and returns customer name with substitutions.
+
+=cut
+
+sub portaone_customer_name {
+ my ($self, $cust_main) = @_;
+ $self->_substitute($self->option('customer_name'),$cust_main);
+}
+
+=head2 portaone_account_id
+
+Accepts I<$svc_phone> and returns account id with substitutions.
+
+=cut
+
+sub portaone_account_id {
+ my ($self, $svc_phone) = @_;
+ $self->_substitute($self->option('account_id'),$svc_phone);
+}
+