From 7fcbf7344be5bc441bed38e42f93794c27644601 Mon Sep 17 00:00:00 2001 From: "Kyle J. McKay" Date: Thu, 29 Oct 2020 06:15:44 -0700 Subject: [PATCH] shlib.sh: only dump Girocco::Config scalars into shlib_vars.sh Make use of the new Girocco::Dumper::Scalars function to limit the items dumped into 'shlib_vars.sh' to only those variables which are actually scalars (i.e. not hashes, arrays, subroutines, etc.). Signed-off-by: Kyle J. McKay --- shlib.sh | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/shlib.sh b/shlib.sh index 9b42dd6..48593c4 100644 --- a/shlib.sh +++ b/shlib.sh @@ -50,7 +50,7 @@ vcmp() { unset orig_path get_girocco_config_pm_var_list() ( - # Export all the variables from Girocco::Config to suitable var= lines + # Export all the scalar variables from Girocco::Config to suitable var= lines # prefixing them with 'cfg_'. E.g. $cfg_admin is admin's mail address now # and also setting a 'defined_cfg_' prefix to 1 if they are not undef. __girocco_conf="$GIROCCO_CONF" @@ -59,8 +59,8 @@ get_girocco_config_pm_var_list() ( inc_basedir=@basedir@ [ "@basedir@" != '@'basedir'@' ] || inc_basedir="$PWD" [ -z "$orig_path" ] || { PATH="$orig_path" && export PATH; } - perl -I"$inc_basedir" $__girocco_extrainc -M$__girocco_conf -le \ - 'foreach (sort {uc($a) cmp uc($b)} keys %Girocco::Config::) { + perl -I"$inc_basedir" $__girocco_extrainc -M$__girocco_conf -MGirocco::Dumper=Scalars -le \ + 'foreach (Scalars("Girocco::Config")) { my $val = ${$Girocco::Config::{$_}}; defined($val) or $val=""; $val =~ s/([\\"\$\`])/\\$1/gos; $val =~ s/(?:\r\n|\r|\n)$//os; -- 2.11.4.GIT