Changeset 291 in ProjectBuilder for devel/pb/lib/ProjectBuilder/Base.pm
- Timestamp:
- Dec 20, 2007, 11:10:49 AM (16 years ago)
- File:
-
- 1 edited
Legend:
- Unmodified
- Added
- Removed
-
devel/pb/lib/ProjectBuilder/Base.pm
r288 r291 11 11 use File::Path; 12 12 use File::Temp qw /tempdir/; 13 use AppConfig qw(ARGCOUNT_HASH);14 13 use Data::Dumper; 15 14 … … 127 126 } 128 127 } 129 die "Invalid version name $ENV{'PBVER'} in $ENV{'PBCONF'}/$proj.pb" if (($ENV{'PBVER'} !~ /[0-9.]+/) && (not exists $version{$ENV{'PBVER'}}));128 die "Invalid version name $ENV{'PBVER'} in $ENV{'PBCONF'}/$proj.pb" if (($ENV{'PBVER'} !~ /[0-9.]+/) && (not defined $version) && ($ENV{'PBVER'} =~ /$version{$proj}/)); 130 129 131 130 if (not defined $ENV{'PBTAG'}) { … … 754 753 } 755 754 756 sub pb_no_err {757 }758 759 755 # Function which returns a pointer on a hash 760 756 # corresponding to a declaration (arg2) in a conf file (arg1) … … 765 761 my $trace; 766 762 my @ptr; 763 my %h; 767 764 768 765 my $debug = 0; 769 766 770 if ($debug > 0) { 771 $trace = 1; 772 } else { 773 $trace = 0; 774 } 775 776 777 my $config = AppConfig->new({ 778 # Auto Create variables mentioned in Conf file 779 CREATE => 1, 780 DEBUG => $trace, 781 ERROR => \&pb_no_err, 782 GLOBAL => { 783 # Each conf item is a hash 784 ARGCOUNT => ARGCOUNT_HASH, 785 }, 786 }); 787 $config->file($conffile); 767 open(CONF,$conffile) || die "Unable to open $conffile"; 768 while(<CONF>) { 769 if (/^\s*([A-z0-9-_]+)\s+([[A-z0-9-_]+)\s*=\s*(.+)$/) { 770 print "DEBUG: 1:$1 2:$2 3:$3\n" if ($debug >= 1); 771 $h{$1}{$2}=$3; 772 } 773 } 774 close(CONF); 775 788 776 for my $param (@param) { 789 push @ptr,$ config->get($param);790 } 791 print "DEBUG: params: ".Dumper(@param)."".Dumper(@ptr)."\n" if ($debug >= 1);777 push @ptr,$h{$param}; 778 } 779 print "DEBUG: h:".Dumper(%h)." param:".Dumper(@param)." ptr:".Dumper(@ptr)."\n" if ($debug >= 1); 792 780 return(@ptr); 793 781 } … … 1030 1018 my $ptr; # returned value pointer on the hash of filters 1031 1019 my %ptr; 1020 my %h; 1032 1021 1033 1022 # Global filter files first, then package specificities … … 1062 1051 print $LOG "DEBUG ffiles: ".Dumper(\@ffiles)."\n" if ($debug >= 1); 1063 1052 1064 my $config = AppConfig->new({ 1065 # Auto Create variables mentioned in Conf file 1066 CREATE => 1, 1067 DEBUG => 0, 1068 GLOBAL => { 1069 # Each conf item is a hash 1070 ARGCOUNT => AppConfig::ARGCOUNT_HASH 1053 foreach my $f (@ffiles) { 1054 open(CONF,$f) || next; 1055 while(<CONF>) { 1056 if (/^\s*([A-z0-9-_]+)\s+([[A-z0-9-_]+)\s*=\s*(.+)$/) { 1057 $h{$1}{$2}=$3; 1058 } 1071 1059 } 1072 });1073 1074 $config->file(@ffiles);1075 $ptr = $config->get("filter");1076 print $LOG "DEBUG f:".Dumper($ptr)."\n" if ($debug >= 1);1060 close(CONF); 1061 1062 $ptr = $h{"filter"}; 1063 print $LOG "DEBUG f:".Dumper($ptr)."\n" if ($debug >= 1); 1064 } 1077 1065 } else { 1078 1066 $ptr = { };
Note:
See TracChangeset
for help on using the changeset viewer.