Changeset 2659 in MondoRescue for devel/mr/lib/MondoRescue/Base.pm
- Timestamp:
- Jun 23, 2010, 4:26:59 PM (14 years ago)
- File:
-
- 1 edited
Legend:
- Unmodified
- Added
- Removed
-
devel/mr/lib/MondoRescue/Base.pm
r2650 r2659 25 25 use Exporter; 26 26 27 # Global hash for configuration params of mr 28 my %mr; 29 our $mr = \%mr; 30 27 31 # Export, by default, all the functions into the namespace of 28 32 # any code which uses this module. 29 33 30 34 our @ISA = qw(Exporter); 31 our @EXPORT = qw(mr_init mr_exit );35 our @EXPORT = qw(mr_init mr_exit mr_conf_get $mr); 32 36 33 37 =pod … … 71 75 # 72 76 # Conf files Management 73 # the $ MRMINI_CONF/mondorescue.conf.dist is delivered as part of the project and77 # the $etcdir/mondorescue.conf.dist is delivered as part of the project and 74 78 # its checksum is verified as we need good default values that we can trust 75 79 # … … 106 110 exit($code); 107 111 } 112 113 =item B<mr_conf_get> 114 115 This function get parameters in configuration files and returns from the least significant level (default) to the emost significant level (application name), passing by the project name. 116 It takes a list of parameters to find and returns the values corresponding 117 118 =cut 119 120 121 sub mr_conf_get { 122 my @params = @_; 123 my @ptr = (); 124 my $ptr; 125 126 pb_log(2,"Entering mr_conf_get\n"); 127 my @args1 = pb_conf_get_if(@params); 128 my $proj = $ENV{'PBPROJ'}; 129 $ENV{'PBPROJ'} = $ENV{'PBPKG'}; 130 my @args2 = pb_conf_get_if(@params); 131 foreach my $i (0..$#args1) { 132 $ptr = undef; 133 # Process from least important to more important 134 $ptr = $args1[$i]->{'default'}; 135 $ptr[$i] = $ptr if (defined $ptr); 136 $ptr = $args1[$i]->{$ENV{'PBPROJ'}}; 137 $ptr[$i] = $ptr if (defined $ptr); 138 $ptr = $args2[$i]->{$ENV{'PBPKG'}}; 139 $ptr[$i] = $ptr if (defined $ptr); 140 $ptr[$i] = "Undefined" if (not defined $ptr[$i]); 141 pb_log(2,"Found parameter $params[$i] with value $ptr[$i]\n"); 142 } 143 $ENV{'PBPROJ'} = $proj; 144 return(@ptr); 145 }
Note:
See TracChangeset
for help on using the changeset viewer.