##// END OF EJS Templates
Switch to Config::Tiny. It comes out of the box with ActivePerl at least.
Jani Honkonen -
r1149:b32dfc788188
parent child
Show More
@@ -1,41 +1,33
1 1 package Jobs;
2 2 use File::Basename;
3 use Config::IniFiles;
4
5 # NOTE:
6 # Config::IniFiles is from CPAN
7 # http://search.cpan.org/dist/Config-IniFiles-2.72/
8 #
9 # On windows (ActivePerl) install it from command line by calling:
10 # ppm install Config-IniFiles
3 use Config::Tiny;
11 4
12 5 sub get {
13 6 my $inifile = shift;
14 7 my $jobname = shift;
15 8
16 9 # Strip the prefix from job name when using ${bamboo.buildPlanName}
17 10 my $prefix = "Digia Qt Commercial - Chart component - ";
18 11 $jobname =~ s/$prefix//;
19 12
20 13 # read ini file
21 my %cfg;
22 tie %cfg, 'Config::IniFiles', ( -file => $inifile );
23
14 my $cfg = Config::Tiny->read( $inifile );
15
24 16 # get section from ini by jobname
25 my %job = %{$cfg{$jobname}};
17 my %job = %{$cfg->{$jobname}};
26 18 if (!%job) {
27 19 die ("Unknown jobname! Check $inifile and bamboo job name.");
28 20 }
29 21
30 22 # print out the ini settings
31 23 print "\n\nini file: $inifile\n";
32 24 print "[$jobname]\n";
33 25 foreach (keys %job) {
34 26 print $_ . "=" . $job{$_} . "\n";
35 27 }
36 28 print "\n";
37 29
38 30 return %job;
39 31 }
40 32
41 33 1; No newline at end of file
General Comments 0
You need to be logged in to leave comments. Login now