line |
stmt |
bran |
cond |
sub |
pod |
time |
code |
1
|
|
|
|
|
|
|
package GD::Icons::Config; |
2
|
|
|
|
|
|
|
|
3
|
|
|
|
|
|
|
our $VERSION = '0.04'; |
4
|
|
|
|
|
|
|
|
5
|
|
|
|
|
|
|
# $Id: Config.pm,v 1.9 2007/08/28 14:16:32 canaran Exp $ |
6
|
|
|
|
|
|
|
|
7
|
1
|
|
|
1
|
|
10
|
use warnings; |
|
1
|
|
|
|
|
3
|
|
|
1
|
|
|
|
|
31
|
|
8
|
1
|
|
|
1
|
|
5
|
use strict; |
|
1
|
|
|
|
|
1
|
|
|
1
|
|
|
|
|
25
|
|
9
|
|
|
|
|
|
|
|
10
|
1
|
|
|
1
|
|
5
|
use Carp; |
|
1
|
|
|
|
|
2
|
|
|
1
|
|
|
|
|
83
|
|
11
|
1
|
|
|
1
|
|
1361
|
use Config::General; |
|
1
|
|
|
|
|
37108
|
|
|
1
|
|
|
|
|
85
|
|
12
|
1
|
|
|
1
|
|
1146
|
use Tie::IxHash; |
|
1
|
|
|
|
|
5803
|
|
|
1
|
|
|
|
|
1011
|
|
13
|
|
|
|
|
|
|
|
14
|
|
|
|
|
|
|
our $DEFAULT_OBJ = GD::Icons::Config->new; |
15
|
|
|
|
|
|
|
|
16
|
|
|
|
|
|
|
############### |
17
|
|
|
|
|
|
|
# CONSTRUCTOR # |
18
|
|
|
|
|
|
|
############### |
19
|
|
|
|
|
|
|
|
20
|
|
|
|
|
|
|
sub new { |
21
|
1
|
|
|
1
|
0
|
3
|
my ($class, $config_file) = @_; |
22
|
|
|
|
|
|
|
|
23
|
1
|
|
|
|
|
4
|
my $self = bless {}, $class; |
24
|
|
|
|
|
|
|
|
25
|
1
|
50
|
|
|
|
6
|
if ($config_file) { |
26
|
0
|
|
|
|
|
0
|
my $config = new Config::General($config_file); |
27
|
0
|
|
|
|
|
0
|
tie my %config, "Tie::IxHash"; |
28
|
0
|
|
|
|
|
0
|
%config = $config->getall; |
29
|
0
|
|
|
|
|
0
|
$self->config(\%config); |
30
|
|
|
|
|
|
|
} |
31
|
|
|
|
|
|
|
else { |
32
|
1
|
|
|
|
|
9
|
tie my %config, "Tie::IxHash"; |
33
|
1
|
|
|
|
|
22
|
%config = ( |
34
|
|
|
|
|
|
|
shape => $self->_all_shapes, |
35
|
|
|
|
|
|
|
color => $self->_all_colors, |
36
|
|
|
|
|
|
|
); |
37
|
1
|
|
|
|
|
41
|
$self->config(\%config); |
38
|
|
|
|
|
|
|
} |
39
|
|
|
|
|
|
|
|
40
|
1
|
|
|
|
|
3
|
return $self; |
41
|
|
|
|
|
|
|
} |
42
|
|
|
|
|
|
|
|
43
|
|
|
|
|
|
|
# Function : Get/set method |
44
|
|
|
|
|
|
|
# Arguments : $value |
45
|
|
|
|
|
|
|
# Returns : $value |
46
|
|
|
|
|
|
|
# Notes : None provided. |
47
|
|
|
|
|
|
|
|
48
|
|
|
|
|
|
|
sub config { |
49
|
1
|
|
|
1
|
0
|
2
|
my ($self, $value) = @_; |
50
|
1
|
50
|
|
|
|
31
|
$self->{config} = $value if @_ > 1; |
51
|
1
|
|
|
|
|
3
|
return $self->{config}; |
52
|
|
|
|
|
|
|
} |
53
|
|
|
|
|
|
|
|
54
|
|
|
|
|
|
|
# Function : Command line listing of default config info |
55
|
|
|
|
|
|
|
# Arguments : None |
56
|
|
|
|
|
|
|
# Returns : 1 |
57
|
|
|
|
|
|
|
# Notes : Usage: perl -MGD::Icons::Config -e GD::Icons::Config::list |
58
|
|
|
|
|
|
|
|
59
|
|
|
|
|
|
|
sub list { |
60
|
0
|
|
|
0
|
0
|
0
|
my ($self) = @_; |
61
|
|
|
|
|
|
|
|
62
|
0
|
|
|
|
|
0
|
my $all_shapes = $DEFAULT_OBJ->_all_shapes; |
63
|
0
|
|
|
|
|
0
|
my $all_colors = $DEFAULT_OBJ->_all_colors; |
64
|
|
|
|
|
|
|
|
65
|
0
|
|
|
|
|
0
|
my $list = "*** GD::Icons::Config Version $VERSION - Default Configuration ***\n\n"; |
66
|
|
|
|
|
|
|
|
67
|
0
|
|
|
|
|
0
|
$list .= "# SHAPES\n\n"; |
68
|
0
|
|
|
|
|
0
|
foreach (sort keys %{$all_shapes}) { |
|
0
|
|
|
|
|
0
|
|
69
|
0
|
|
|
|
|
0
|
$list .= sprintf('%-20s%s', $_, $all_shapes->{$_}) . "\n"; |
70
|
|
|
|
|
|
|
} |
71
|
|
|
|
|
|
|
|
72
|
0
|
|
|
|
|
0
|
$list .= "\n# COLORS \n\n"; |
73
|
0
|
|
|
|
|
0
|
foreach (sort keys %{$all_colors}) { |
|
0
|
|
|
|
|
0
|
|
74
|
0
|
|
|
|
|
0
|
$list .= sprintf('%-20s%s', $_, $all_colors->{$_}) . "\n"; |
75
|
|
|
|
|
|
|
} |
76
|
|
|
|
|
|
|
|
77
|
0
|
|
|
|
|
0
|
print $list; |
78
|
|
|
|
|
|
|
|
79
|
0
|
|
|
|
|
0
|
return 1; |
80
|
|
|
|
|
|
|
} |
81
|
|
|
|
|
|
|
|
82
|
|
|
|
|
|
|
####################### |
83
|
|
|
|
|
|
|
# Data storage methos # |
84
|
|
|
|
|
|
|
####################### |
85
|
|
|
|
|
|
|
|
86
|
|
|
|
|
|
|
# Function : Get (storge) method for default shapes |
87
|
|
|
|
|
|
|
# Arguments : None |
88
|
|
|
|
|
|
|
# Returns : \%all |
89
|
|
|
|
|
|
|
# Notes : This is a private method. |
90
|
|
|
|
|
|
|
|
91
|
|
|
|
|
|
|
sub _all_shapes { |
92
|
1
|
|
|
1
|
|
2
|
my ($self) = @_; |
93
|
|
|
|
|
|
|
|
94
|
1
|
|
|
|
|
5
|
tie my %all, "Tie::IxHash"; |
95
|
|
|
|
|
|
|
|
96
|
1
|
|
|
|
|
22
|
%all = ( |
97
|
|
|
|
|
|
|
'square' => |
98
|
|
|
|
|
|
|
qq(sl[11] lt[1] lc[_Black] py[0,0 10,0 10,10 0,10 0,0] fl[5,5]), |
99
|
|
|
|
|
|
|
'triangle' => |
100
|
|
|
|
|
|
|
qq(sl[11] lt[1] lc[_Black] py[5,0 10,10 0,10 5,0] fl[5,5]), |
101
|
|
|
|
|
|
|
'diamond' => |
102
|
|
|
|
|
|
|
qq(sl[11] lt[1] lc[_Black] py[5,0 0,5 5,10 10,5 5,0] fl[5,5]), |
103
|
|
|
|
|
|
|
'l-shape' => |
104
|
|
|
|
|
|
|
qq(sl[11] lt[1] lc[_Black] py[0,0 5,0 5,5 10,5 10,10 0,10 0,0] fl[3,3]), |
105
|
|
|
|
|
|
|
'pi' => |
106
|
|
|
|
|
|
|
qq(sl[11] lt[1] lc[_Black] py[0,0 10,0 10,4 8,4 8,10 6,10 6,4 4,4 4,10 2,10 2,4 0,4 0,0] fl[2,2]), |
107
|
|
|
|
|
|
|
'plus' => |
108
|
|
|
|
|
|
|
qq(sl[11] lt[1] lc[_Black] py[3,0 7,0 7,3 10,3 10,7 7,7 7,10 3,10 3,7 0,7 0,3 3,3 3,0] fl[4,4]), |
109
|
|
|
|
|
|
|
'square-pieces' => |
110
|
|
|
|
|
|
|
qq(sl[11] lt[1] lc[_Black] py[0,0 10,0 10,4 8,4 8,6 10,6 10,10 0,10 0,6 2,6 2,4 0,4 0,0] fl[5,5]), |
111
|
|
|
|
|
|
|
'sand-clock' => |
112
|
|
|
|
|
|
|
qq(sl[11] lt[1] lc[_Black] py[0,0 10,0 5,5 10,10 0,10 5,5 0,0] fl[5,2] fl[5,8]), |
113
|
|
|
|
|
|
|
'_padded-square' => |
114
|
|
|
|
|
|
|
qq(sl[11] lt[1] lc[:fill] py[0,0 0,9 9,9 0,9 0,0] fl[5,5]), |
115
|
|
|
|
|
|
|
'_large_square' => |
116
|
|
|
|
|
|
|
qq(sl[22] lt[1] lc[_Black] py[0,0 21,0 21,21 0,21 0,0] fl[5,5]), |
117
|
|
|
|
|
|
|
'_letter-m' => |
118
|
|
|
|
|
|
|
qq(sl[11] lt[1] lc[_Black] py[0,1 3,1 5,3 7,1 10,1 10,9 7,9 7,4 5,6 3,4 3,9 0,9 0,1] fl[2,2]), |
119
|
|
|
|
|
|
|
'_number-flag' => |
120
|
|
|
|
|
|
|
qq(sl[14] lt[1] lc[_Black] py[0,0 13,0 13,13 0,13 0,0] fl[5,5] nm[:auto]), |
121
|
|
|
|
|
|
|
); |
122
|
|
|
|
|
|
|
|
123
|
1
|
|
|
|
|
188
|
return \%all; |
124
|
|
|
|
|
|
|
} |
125
|
|
|
|
|
|
|
|
126
|
|
|
|
|
|
|
# Function : Get (storge) method for default colors |
127
|
|
|
|
|
|
|
# Arguments : None |
128
|
|
|
|
|
|
|
# Returns : \%all |
129
|
|
|
|
|
|
|
# Notes : This is a private method.. |
130
|
|
|
|
|
|
|
|
131
|
|
|
|
|
|
|
sub _all_colors { |
132
|
1
|
|
|
1
|
|
3
|
my ($self) = @_; |
133
|
|
|
|
|
|
|
|
134
|
1
|
|
|
|
|
6
|
tie my %all, "Tie::IxHash"; |
135
|
|
|
|
|
|
|
|
136
|
1
|
|
|
|
|
19
|
%all = ( |
137
|
|
|
|
|
|
|
Blue => '#0000FF', |
138
|
|
|
|
|
|
|
BlueViolet => '#8A2BE2', |
139
|
|
|
|
|
|
|
Brown => '#A52A2A', |
140
|
|
|
|
|
|
|
BurlyWood => '#DEB887', |
141
|
|
|
|
|
|
|
CadetBlue => '#5F9EA0', |
142
|
|
|
|
|
|
|
Chartreuse => '#7FFF00', |
143
|
|
|
|
|
|
|
Chocolate => '#D2691E', |
144
|
|
|
|
|
|
|
Coral => '#FF7F50', |
145
|
|
|
|
|
|
|
CornflowerBlue => '#6495ED', |
146
|
|
|
|
|
|
|
Cornsilk => '#FFF8DC', |
147
|
|
|
|
|
|
|
Crimson => '#DC143C', |
148
|
|
|
|
|
|
|
Cyan => '#00FFFF', |
149
|
|
|
|
|
|
|
DarkBlue => '#00008B', |
150
|
|
|
|
|
|
|
DarkGreen => '#006400', |
151
|
|
|
|
|
|
|
DarkKhaki => '#BDB76B', |
152
|
|
|
|
|
|
|
DarkOliveGreen => '#556B2F', |
153
|
|
|
|
|
|
|
Darkorange => '#FF8C00', |
154
|
|
|
|
|
|
|
DarkSalmon => '#E9967A', |
155
|
|
|
|
|
|
|
DarkSeaGreen => '#8FBC8F', |
156
|
|
|
|
|
|
|
DarkSlateBlue => '#483D8B', |
157
|
|
|
|
|
|
|
DarkTurquoise => '#00CED1', |
158
|
|
|
|
|
|
|
DodgerBlue => '#1E90FF', |
159
|
|
|
|
|
|
|
ForestGreen => '#228B22', |
160
|
|
|
|
|
|
|
Gold => '#FFD700', |
161
|
|
|
|
|
|
|
Gray => '#808080', |
162
|
|
|
|
|
|
|
Green => '#008000', |
163
|
|
|
|
|
|
|
GreenYellow => '#ADFF2F', |
164
|
|
|
|
|
|
|
Indigo => '#4B0082', |
165
|
|
|
|
|
|
|
Khaki => '#F0E68C', |
166
|
|
|
|
|
|
|
Lavender => '#E6E6FA', |
167
|
|
|
|
|
|
|
LavenderBlush => '#FFF0F5', |
168
|
|
|
|
|
|
|
LemonChiffon => '#FFFACD', |
169
|
|
|
|
|
|
|
LightBlue => '#ADD8E6', |
170
|
|
|
|
|
|
|
LightCoral => '#F08080', |
171
|
|
|
|
|
|
|
LightCyan => '#E0FFFF', |
172
|
|
|
|
|
|
|
LightGoldenRodYellow => '#FAFAD2', |
173
|
|
|
|
|
|
|
LightGray => '#D3D3D3', |
174
|
|
|
|
|
|
|
LightGrey => '#D3D3D3', |
175
|
|
|
|
|
|
|
LightGreen => '#90EE90', |
176
|
|
|
|
|
|
|
LightPink => '#FFB6C1', |
177
|
|
|
|
|
|
|
LightSalmon => '#FFA07A', |
178
|
|
|
|
|
|
|
LightSeaGreen => '#20B2AA', |
179
|
|
|
|
|
|
|
LightSkyBlue => '#87CEFA', |
180
|
|
|
|
|
|
|
LightSlateGray => '#778899', |
181
|
|
|
|
|
|
|
LightSteelBlue => '#B0C4DE', |
182
|
|
|
|
|
|
|
LightYellow => '#FFFFE0', |
183
|
|
|
|
|
|
|
Maroon => '#800000', |
184
|
|
|
|
|
|
|
MediumBlue => '#0000CD', |
185
|
|
|
|
|
|
|
MidnightBlue => '#191970', |
186
|
|
|
|
|
|
|
MistyRose => '#FFE4E1', |
187
|
|
|
|
|
|
|
Moccasin => '#FFE4B5', |
188
|
|
|
|
|
|
|
Navy => '#000080', |
189
|
|
|
|
|
|
|
Olive => '#808000', |
190
|
|
|
|
|
|
|
OliveDrab => '#6B8E23', |
191
|
|
|
|
|
|
|
Orange => '#FFA500', |
192
|
|
|
|
|
|
|
OrangeRed => '#FF4500', |
193
|
|
|
|
|
|
|
Orchid => '#DA70D6', |
194
|
|
|
|
|
|
|
PowderBlue => '#B0E0E6', |
195
|
|
|
|
|
|
|
Purple => '#800080', |
196
|
|
|
|
|
|
|
Red => '#FF0000', |
197
|
|
|
|
|
|
|
RosyBrown => '#BC8F8F', |
198
|
|
|
|
|
|
|
RoyalBlue => '#4169E1', |
199
|
|
|
|
|
|
|
SaddleBrown => '#8B4513', |
200
|
|
|
|
|
|
|
Salmon => '#FA8072', |
201
|
|
|
|
|
|
|
SandyBrown => '#F4A460', |
202
|
|
|
|
|
|
|
SeaGreen => '#2E8B57', |
203
|
|
|
|
|
|
|
SeaShell => '#FFF5EE', |
204
|
|
|
|
|
|
|
Sienna => '#A0522D', |
205
|
|
|
|
|
|
|
Silver => '#C0C0C0', |
206
|
|
|
|
|
|
|
SkyBlue => '#87CEEB', |
207
|
|
|
|
|
|
|
SlateBlue => '#6A5ACD', |
208
|
|
|
|
|
|
|
SlateGray => '#708090', |
209
|
|
|
|
|
|
|
SpringGreen => '#00FF7F', |
210
|
|
|
|
|
|
|
SteelBlue => '#4682B4', |
211
|
|
|
|
|
|
|
Tan => '#D2B48C', |
212
|
|
|
|
|
|
|
Teal => '#008080', |
213
|
|
|
|
|
|
|
Thistle => '#D8BFD8', |
214
|
|
|
|
|
|
|
Tomato => '#FF6347', |
215
|
|
|
|
|
|
|
Turquoise => '#40E0D0', |
216
|
|
|
|
|
|
|
Violet => '#EE82EE', |
217
|
|
|
|
|
|
|
Wheat => '#F5DEB3', |
218
|
|
|
|
|
|
|
Yellow => '#FFFF00', |
219
|
|
|
|
|
|
|
YellowGreen => '#9ACD32', |
220
|
|
|
|
|
|
|
_Black => '#000000', |
221
|
|
|
|
|
|
|
_White => '#FFFFFF', |
222
|
|
|
|
|
|
|
); |
223
|
|
|
|
|
|
|
|
224
|
1
|
|
|
|
|
1030
|
return \%all; |
225
|
|
|
|
|
|
|
} |
226
|
|
|
|
|
|
|
|
227
|
|
|
|
|
|
|
1; |
228
|
|
|
|
|
|
|
|
229
|
|
|
|
|
|
|
__END__ |