| line |
stmt |
bran |
cond |
sub |
pod |
time |
code |
|
1
|
|
|
|
|
|
|
package Config::Abstract::Ini; |
|
2
|
|
|
|
|
|
|
|
|
3
|
1
|
|
|
1
|
|
15
|
use 5.006; |
|
|
1
|
|
|
|
|
2
|
|
|
|
1
|
|
|
|
|
34
|
|
|
4
|
1
|
|
|
1
|
|
4
|
use strict; |
|
|
1
|
|
|
|
|
2
|
|
|
|
1
|
|
|
|
|
25
|
|
|
5
|
1
|
|
|
1
|
|
3
|
use warnings; |
|
|
1
|
|
|
|
|
2
|
|
|
|
1
|
|
|
|
|
30
|
|
|
6
|
|
|
|
|
|
|
|
|
7
|
|
|
|
|
|
|
require Exporter; |
|
8
|
1
|
|
|
1
|
|
429
|
use Config::Abstract; |
|
|
1
|
|
|
|
|
2
|
|
|
|
1
|
|
|
|
|
59
|
|
|
9
|
|
|
|
|
|
|
|
|
10
|
1
|
|
|
1
|
|
4
|
use overload qw{""} => \&_to_string; |
|
|
1
|
|
|
|
|
2
|
|
|
|
1
|
|
|
|
|
6
|
|
|
11
|
|
|
|
|
|
|
|
|
12
|
|
|
|
|
|
|
our @ISA = qw(Config::Abstract Exporter); |
|
13
|
|
|
|
|
|
|
our %EXPORT_TAGS = ( 'all' => [ qw( ) ] ); |
|
14
|
|
|
|
|
|
|
our @EXPORT_OK = ( @{ $EXPORT_TAGS{'all'} } ); |
|
15
|
|
|
|
|
|
|
our @EXPORT = qw( ); |
|
16
|
|
|
|
|
|
|
|
|
17
|
|
|
|
|
|
|
our $VERSION = '0.16'; |
|
18
|
|
|
|
|
|
|
|
|
19
|
|
|
|
|
|
|
# |
|
20
|
|
|
|
|
|
|
# ------------------------------------------------------------------------------------------------------- structural methods ----- |
|
21
|
|
|
|
|
|
|
# |
|
22
|
|
|
|
|
|
|
|
|
23
|
|
|
|
|
|
|
# All inherited from Config::Abstract |
|
24
|
|
|
|
|
|
|
|
|
25
|
|
|
|
|
|
|
# |
|
26
|
|
|
|
|
|
|
# --------------------------------------------------------------------------------------------------------- accessor methods ----- |
|
27
|
|
|
|
|
|
|
# |
|
28
|
|
|
|
|
|
|
|
|
29
|
|
|
|
|
|
|
# All inherited from Config::Abstract |
|
30
|
|
|
|
|
|
|
|
|
31
|
|
|
|
|
|
|
# |
|
32
|
|
|
|
|
|
|
# ------------------------------------------------------------------------------------------------ (un)serialisation methods ----- |
|
33
|
|
|
|
|
|
|
# |
|
34
|
|
|
|
|
|
|
|
|
35
|
|
|
|
|
|
|
################################################## |
|
36
|
|
|
|
|
|
|
#%name: _to_string |
|
37
|
|
|
|
|
|
|
#%syntax: _to_string |
|
38
|
|
|
|
|
|
|
#%summary: Recursively generates a string representation of the settings hash |
|
39
|
|
|
|
|
|
|
#%returns: a string in .ini format |
|
40
|
|
|
|
|
|
|
|
|
41
|
|
|
|
|
|
|
sub _to_string{ |
|
42
|
0
|
|
|
0
|
|
|
my($self) = @_; |
|
43
|
0
|
|
|
|
|
|
return $self->_dumpobject('',$self->{_settings}); |
|
44
|
|
|
|
|
|
|
} |
|
45
|
|
|
|
|
|
|
|
|
46
|
|
|
|
|
|
|
################################################## |
|
47
|
|
|
|
|
|
|
#%name: _dumpobject |
|
48
|
|
|
|
|
|
|
#%syntax: _dumpobject(<$objectcaption>,<$objectref>,[<@parentobjectcaptions>]) |
|
49
|
|
|
|
|
|
|
#%summary: Recursively generates a string representation of the object referenced |
|
50
|
|
|
|
|
|
|
# by $objectref |
|
51
|
|
|
|
|
|
|
#%returns: a string representation of the object |
|
52
|
|
|
|
|
|
|
|
|
53
|
|
|
|
|
|
|
sub _dumpobject{ |
|
54
|
0
|
|
|
0
|
|
|
my($self,$name,$obj,@parents) = @_; |
|
55
|
0
|
|
|
|
|
|
my @result = (); |
|
56
|
0
|
0
|
|
|
|
|
if(ref($obj) eq 'HASH'){ |
|
|
|
0
|
|
|
|
|
|
|
|
|
0
|
|
|
|
|
|
|
57
|
0
|
0
|
|
|
|
|
unless($name eq ''){ |
|
58
|
0
|
|
|
|
|
|
push(@parents,"$name"); |
|
59
|
0
|
|
|
|
|
|
push(@result,'[' . join('::',@parents) . ']'); |
|
60
|
|
|
|
|
|
|
} |
|
61
|
0
|
|
|
|
|
|
while(my($key,$val) = each(%{$obj})){ |
|
|
0
|
|
|
|
|
|
|
|
62
|
0
|
|
|
|
|
|
push(@result,$self->_dumpobject($key,$val,@parents)); |
|
63
|
|
|
|
|
|
|
} |
|
64
|
|
|
|
|
|
|
}elsif(ref($obj) eq 'SCALAR'){ |
|
65
|
0
|
|
|
|
|
|
push(@result,"$name = ${$obj}"); |
|
|
0
|
|
|
|
|
|
|
|
66
|
|
|
|
|
|
|
}elsif(ref($obj) eq 'ARRAY'){ |
|
67
|
0
|
|
|
|
|
|
push(@parents,"$name"); |
|
68
|
0
|
|
|
|
|
|
push(@result,'[' . join('::',@parents) . ']'); |
|
69
|
0
|
|
|
|
|
|
for(my $i = 0;scalar(@{$obj});$i++){ |
|
|
0
|
|
|
|
|
|
|
|
70
|
0
|
|
|
|
|
|
push(@result,$self->_dumpobject($i,${$obj}[$i],@parents)); |
|
|
0
|
|
|
|
|
|
|
|
71
|
|
|
|
|
|
|
} |
|
72
|
|
|
|
|
|
|
}else{ |
|
73
|
|
|
|
|
|
|
# print("Why are we here? name: " . ( defined($name) ? $name : 'empty' ) . " obj:" . ( defined($obj) ? $obj : 'empty' ) . "\n");#DEBUG!!! |
|
74
|
0
|
0
|
|
|
|
|
push(@result,"$name = " . (defined($obj) ? $obj : '') ) unless(!defined($name)); |
|
|
|
0
|
|
|
|
|
|
|
75
|
|
|
|
|
|
|
} |
|
76
|
0
|
|
|
|
|
|
return(join("\n",@result)); |
|
77
|
|
|
|
|
|
|
} |
|
78
|
|
|
|
|
|
|
|
|
79
|
|
|
|
|
|
|
|
|
80
|
|
|
|
|
|
|
################################################## |
|
81
|
|
|
|
|
|
|
#%name: _parse_settings_file |
|
82
|
|
|
|
|
|
|
#%syntax: _parse_settings_file(<@settings>) |
|
83
|
|
|
|
|
|
|
#%summary: Reads the projects to keep track of |
|
84
|
|
|
|
|
|
|
#%returns: a hash of $projectkey:$projectlabel |
|
85
|
|
|
|
|
|
|
|
|
86
|
|
|
|
|
|
|
sub _parse_settings_file{ |
|
87
|
0
|
|
|
0
|
|
|
my %result = (); |
|
88
|
0
|
|
|
|
|
|
my ($entry,$subentry) = ('',undef); |
|
89
|
0
|
|
|
|
|
|
chomp(@_); |
|
90
|
0
|
|
|
|
|
|
foreach(@_){ |
|
91
|
|
|
|
|
|
|
# Get rid of starting/ending whitespace |
|
92
|
0
|
|
|
|
|
|
s/^\s*(.*?)\s*$/$1/; |
|
93
|
|
|
|
|
|
|
|
|
94
|
|
|
|
|
|
|
#Delete comments |
|
95
|
0
|
|
|
|
|
|
($_) = split(/[;#]/,$_); |
|
96
|
|
|
|
|
|
|
#Skip if there's no data |
|
97
|
0
|
0
|
0
|
|
|
|
next if((! defined($_)) || $_ eq ''); |
|
98
|
0
|
0
|
|
|
|
|
/^\s*(.*?)\s*=\s*(['"]|)(.*)\2\s*/ && do { |
|
99
|
0
|
|
|
|
|
|
my($key,$val) = ($1,$3); |
|
100
|
0
|
0
|
0
|
|
|
|
next if($key eq '' || $val eq ''); |
|
101
|
0
|
0
|
0
|
|
|
|
if(! defined($subentry) || $subentry =~ /^\s*$/){ |
|
102
|
0
|
|
|
|
|
|
${$result{$entry}}{$key} = $val; |
|
|
0
|
|
|
|
|
|
|
|
103
|
|
|
|
|
|
|
}else{ |
|
104
|
0
|
|
|
|
|
|
${$result{$entry}}{$subentry}{$key} = $val; |
|
|
0
|
|
|
|
|
|
|
|
105
|
|
|
|
|
|
|
} |
|
106
|
0
|
|
|
|
|
|
next; |
|
107
|
|
|
|
|
|
|
}; |
|
108
|
|
|
|
|
|
|
# Select a new entry if this is such a line |
|
109
|
0
|
0
|
|
|
|
|
/\[(.*?)\]/ && do{ |
|
110
|
|
|
|
|
|
|
|
|
111
|
0
|
|
|
|
|
|
$_ = $1; |
|
112
|
0
|
|
|
|
|
|
($entry,$subentry) = split('::'); |
|
113
|
0
|
0
|
0
|
|
|
|
if(! defined($subentry) || $subentry =~ /^\s*$/){ |
|
|
|
0
|
|
|
|
|
|
|
114
|
0
|
|
|
|
|
|
$result{$entry} = {}; |
|
115
|
|
|
|
|
|
|
}elsif($result{$entry}){ |
|
116
|
0
|
|
|
|
|
|
$result{$entry}{$subentry} = {}; |
|
117
|
|
|
|
|
|
|
} |
|
118
|
0
|
|
|
|
|
|
next; |
|
119
|
|
|
|
|
|
|
}; |
|
120
|
|
|
|
|
|
|
} |
|
121
|
0
|
|
|
|
|
|
return(\%result); |
|
122
|
|
|
|
|
|
|
} |
|
123
|
|
|
|
|
|
|
|
|
124
|
|
|
|
|
|
|
# We provide a DESTROY method so that the autoloader |
|
125
|
|
|
|
|
|
|
# doesn't bother trying to find it. |
|
126
|
0
|
|
|
0
|
|
|
sub DESTROY { } |
|
127
|
|
|
|
|
|
|
|
|
128
|
|
|
|
|
|
|
# Autoload methods go after =cut, and are processed by the autosplit program. |
|
129
|
|
|
|
|
|
|
|
|
130
|
|
|
|
|
|
|
1; |
|
131
|
|
|
|
|
|
|
__END__ |