From c10d0f9d776ab506bf48aed8935ff6bd09dc0076 Mon Sep 17 00:00:00 2001 From: Andreas Granig Date: Thu, 28 Jan 2016 22:22:06 +0100 Subject: [PATCH] MT#12385 Fix using EXPORT_CONDITIONS On a stock master CE, running edr exporter results in this error: $ /usr/sbin/event-exporter Can't use string ("{ accounting.events.export_statu"...) as an ARRAY ref while "strict refs" in use at /usr/share/perl5/NGCP/CDR/Exporter.pm line 135. Reason is that EXPORT_CONDITION only has one element in the default config, and therefore confval() returns a scalar instead of an array ref. Using get_config_fields() instead always forces an array we can iterate over. Change-Id: Id6d049b4275a52dc5760a636472082de625d2ac8 --- NGCP/CDR/Exporter.pm | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/NGCP/CDR/Exporter.pm b/NGCP/CDR/Exporter.pm index a2f4d7b..9f83ddf 100644 --- a/NGCP/CDR/Exporter.pm +++ b/NGCP/CDR/Exporter.pm @@ -121,7 +121,7 @@ sub get_config { @reseller_fields = get_config_fields('RESELLER_EXPORT_FIELDS'); @data_fields = get_config_fields('DATA_FIELDS'); - foreach my $f(@{confval('EXPORT_JOINS')}) { + foreach my $f(get_config_fields('EXPORT_JOINS')) { $f =~ s/^\s*\{?\s*//; $f =~ s/\}\s*\}\s*$/}/; my ($a, $b) = split('\s*=>\s*{\s*', $f); $a =~ s/^\s*\'//; $a =~ s/\'$//g; @@ -132,7 +132,7 @@ sub get_config { push @joins, { $a => { $c => $d } }; } - foreach my $f(@{confval('EXPORT_CONDITIONS')}) { + foreach my $f(get_config_fields('EXPORT_CONDITIONS')) { next unless($f); $f =~ s/^\s*\{?\s*//; $f =~ s/\}\s*\}\s*$/}/; my ($a, $b) = split('\s*=>\s*{\s*', $f);