# create substitution table
###
my %hash;
- my @objects = ($cust_main);
- my @prefixes = ('');
- if( ref $object ) {
- if( ref($object) eq 'ARRAY' ) {
- # [new, old], for provisioning tickets
- push @objects, $object->[0], $object->[1];
- push @prefixes, 'new_', 'old_';
- }
- else {
- push @objects, $object;
- push @prefixes, '';
- }
- }
-
- foreach my $obj (@objects) {
- my $prefix = shift @prefixes;
+ foreach my $obj ($cust_main, $object || ()) {
foreach my $name (@{ $subs->{$obj->table} }) {
if(!ref($name)) {
# simple case
- $hash{$prefix.$name} = $obj->$name();
+ $hash{$name} = $obj->$name();
}
elsif( ref($name) eq 'ARRAY' ) {
# [ foo => sub { ... } ]
- $hash{$prefix.($name->[0])} = $name->[1]->($obj);
+ $hash{$name->[0]} = $name->[1]->($obj);
}
else {
warn "bad msg_template substitution: '$name'\n";
# for welcome and limit warning messages
'svc_acct' => [qw(
- svcnum
username
- domain
),
[ password => sub { shift->getfield('_password') } ],
],