| line |
stmt |
bran |
cond |
sub |
pod |
time |
code |
|
1
|
|
|
|
|
|
|
# |
|
2
|
|
|
|
|
|
|
# This file is part of StorageDisplay |
|
3
|
|
|
|
|
|
|
# |
|
4
|
|
|
|
|
|
|
# This software is copyright (c) 2014-2023 by Vincent Danjean. |
|
5
|
|
|
|
|
|
|
# |
|
6
|
|
|
|
|
|
|
# This is free software; you can redistribute it and/or modify it under |
|
7
|
|
|
|
|
|
|
# the same terms as the Perl 5 programming language system itself. |
|
8
|
|
|
|
|
|
|
# |
|
9
|
1
|
|
|
1
|
|
7
|
use strict; |
|
|
1
|
|
|
|
|
3
|
|
|
|
1
|
|
|
|
|
31
|
|
|
10
|
1
|
|
|
1
|
|
5
|
use warnings; |
|
|
1
|
|
|
|
|
3
|
|
|
|
1
|
|
|
|
|
54
|
|
|
11
|
|
|
|
|
|
|
|
|
12
|
|
|
|
|
|
|
package StorageDisplay::Role; |
|
13
|
|
|
|
|
|
|
# ABSTRACT: Load all roles used in StorageDisplay |
|
14
|
|
|
|
|
|
|
|
|
15
|
|
|
|
|
|
|
our $VERSION = '2.04'; # VERSION |
|
16
|
|
|
|
|
|
|
|
|
17
|
|
|
|
|
|
|
1; |
|
18
|
|
|
|
|
|
|
|
|
19
|
|
|
|
|
|
|
################################################################## |
|
20
|
|
|
|
|
|
|
package StorageDisplay::Role::ProvideName::Plain; |
|
21
|
|
|
|
|
|
|
|
|
22
|
1
|
|
|
1
|
|
450
|
use Moose::Role; |
|
|
1
|
|
|
|
|
4911
|
|
|
|
1
|
|
|
|
|
5
|
|
|
23
|
|
|
|
|
|
|
|
|
24
|
|
|
|
|
|
|
sub name; # forward decl for 'requires' |
|
25
|
|
|
|
|
|
|
has 'name' => ( |
|
26
|
|
|
|
|
|
|
is => 'ro', |
|
27
|
|
|
|
|
|
|
isa => 'Str', |
|
28
|
|
|
|
|
|
|
init_arg => 'name', |
|
29
|
|
|
|
|
|
|
required => 1, |
|
30
|
|
|
|
|
|
|
); |
|
31
|
|
|
|
|
|
|
|
|
32
|
|
|
|
|
|
|
1; |
|
33
|
|
|
|
|
|
|
|
|
34
|
|
|
|
|
|
|
################################################################## |
|
35
|
|
|
|
|
|
|
package StorageDisplay::Role::ProvideName::Recursive; |
|
36
|
|
|
|
|
|
|
|
|
37
|
1
|
|
|
1
|
|
5594
|
use Moose::Role; |
|
|
1
|
|
|
|
|
2
|
|
|
|
1
|
|
|
|
|
5
|
|
|
38
|
1
|
|
|
1
|
|
5107
|
use Carp; |
|
|
1
|
|
|
|
|
2
|
|
|
|
1
|
|
|
|
|
595
|
|
|
39
|
|
|
|
|
|
|
|
|
40
|
|
|
|
|
|
|
requires 'has_parent'; |
|
41
|
|
|
|
|
|
|
|
|
42
|
|
|
|
|
|
|
has '_name' => ( |
|
43
|
|
|
|
|
|
|
is => 'ro', |
|
44
|
|
|
|
|
|
|
isa => 'Str', |
|
45
|
|
|
|
|
|
|
init_arg => 'name', |
|
46
|
|
|
|
|
|
|
required => 1, |
|
47
|
|
|
|
|
|
|
lazy => 1, |
|
48
|
|
|
|
|
|
|
default => sub { |
|
49
|
|
|
|
|
|
|
my $self = shift; |
|
50
|
|
|
|
|
|
|
if (!$self->ignore_name) { |
|
51
|
|
|
|
|
|
|
confess "no name provided and ignore_name not set in $self\n"; |
|
52
|
|
|
|
|
|
|
} |
|
53
|
|
|
|
|
|
|
return "NONAME"; |
|
54
|
|
|
|
|
|
|
}, |
|
55
|
|
|
|
|
|
|
); |
|
56
|
|
|
|
|
|
|
|
|
57
|
|
|
|
|
|
|
sub name; # forward decl for 'requires' |
|
58
|
|
|
|
|
|
|
has 'name' => ( |
|
59
|
|
|
|
|
|
|
is => 'ro', |
|
60
|
|
|
|
|
|
|
isa => 'Str', |
|
61
|
|
|
|
|
|
|
init_arg => undef, |
|
62
|
|
|
|
|
|
|
required => 1, |
|
63
|
|
|
|
|
|
|
lazy => 1, |
|
64
|
|
|
|
|
|
|
default => sub { |
|
65
|
|
|
|
|
|
|
my $self = shift; |
|
66
|
|
|
|
|
|
|
my $lname = $self->name_prefix; |
|
67
|
|
|
|
|
|
|
if (!$self->ignore_name) { |
|
68
|
|
|
|
|
|
|
$lname .= '@'.$self->_name; |
|
69
|
|
|
|
|
|
|
} |
|
70
|
|
|
|
|
|
|
#print STDERR "In $self\t: using $lname as name\n"; |
|
71
|
|
|
|
|
|
|
return $lname; |
|
72
|
|
|
|
|
|
|
}, |
|
73
|
|
|
|
|
|
|
); |
|
74
|
|
|
|
|
|
|
|
|
75
|
|
|
|
|
|
|
has 'fullname' => ( |
|
76
|
|
|
|
|
|
|
is => 'ro', |
|
77
|
|
|
|
|
|
|
isa => 'Str', |
|
78
|
|
|
|
|
|
|
init_arg => undef, |
|
79
|
|
|
|
|
|
|
required => 1, |
|
80
|
|
|
|
|
|
|
lazy => 1, |
|
81
|
|
|
|
|
|
|
default => sub { |
|
82
|
|
|
|
|
|
|
my $self = shift; |
|
83
|
|
|
|
|
|
|
my $lname = $self->fullname_prefix; |
|
84
|
|
|
|
|
|
|
if (!$self->ignore_name) { |
|
85
|
|
|
|
|
|
|
$lname .= '@'.$self->_name; |
|
86
|
|
|
|
|
|
|
} |
|
87
|
|
|
|
|
|
|
if (! $self->has_parent) { |
|
88
|
|
|
|
|
|
|
#print STDERR "no parent in fullname for $self\n"; |
|
89
|
|
|
|
|
|
|
return $lname; |
|
90
|
|
|
|
|
|
|
} |
|
91
|
|
|
|
|
|
|
my $fullname = join('|', $self->parent->fullname, $lname); |
|
92
|
|
|
|
|
|
|
#print STDERR "In $self\t: using $fullname as fullname\n"; |
|
93
|
|
|
|
|
|
|
return $fullname; |
|
94
|
|
|
|
|
|
|
}, |
|
95
|
|
|
|
|
|
|
); |
|
96
|
|
|
|
|
|
|
|
|
97
|
|
|
|
|
|
|
has 'name_prefix' => ( |
|
98
|
|
|
|
|
|
|
is => 'ro', |
|
99
|
|
|
|
|
|
|
isa => 'Str', |
|
100
|
|
|
|
|
|
|
required => 1, |
|
101
|
|
|
|
|
|
|
lazy => 1, |
|
102
|
|
|
|
|
|
|
default => sub { |
|
103
|
|
|
|
|
|
|
my $self = shift; |
|
104
|
|
|
|
|
|
|
my $kind = ref($self); |
|
105
|
|
|
|
|
|
|
$kind =~ s/^StorageDisplay::Data:://; |
|
106
|
|
|
|
|
|
|
return $kind; |
|
107
|
|
|
|
|
|
|
}, |
|
108
|
|
|
|
|
|
|
); |
|
109
|
|
|
|
|
|
|
|
|
110
|
|
|
|
|
|
|
has 'fullname_prefix' => ( |
|
111
|
|
|
|
|
|
|
is => 'ro', |
|
112
|
|
|
|
|
|
|
isa => 'Str', |
|
113
|
|
|
|
|
|
|
init_arg => undef, |
|
114
|
|
|
|
|
|
|
required => 1, |
|
115
|
|
|
|
|
|
|
lazy => 1, |
|
116
|
|
|
|
|
|
|
default => sub { |
|
117
|
|
|
|
|
|
|
my $self = shift; |
|
118
|
|
|
|
|
|
|
my $kind = ref($self); |
|
119
|
|
|
|
|
|
|
$kind =~ s/^StorageDisplay::Data:://; |
|
120
|
|
|
|
|
|
|
my $name_prefix = $self->name_prefix; |
|
121
|
|
|
|
|
|
|
if ($kind ne $name_prefix) { |
|
122
|
|
|
|
|
|
|
return $name_prefix; |
|
123
|
|
|
|
|
|
|
} |
|
124
|
|
|
|
|
|
|
if ($self->has_parent) { |
|
125
|
|
|
|
|
|
|
my $pkind = ref($self->parent); |
|
126
|
|
|
|
|
|
|
$pkind =~ s/^StorageDisplay::Data:://; |
|
127
|
|
|
|
|
|
|
$kind =~ s/^$pkind//; |
|
128
|
|
|
|
|
|
|
} |
|
129
|
|
|
|
|
|
|
return $kind; |
|
130
|
|
|
|
|
|
|
}, |
|
131
|
|
|
|
|
|
|
); |
|
132
|
|
|
|
|
|
|
|
|
133
|
|
|
|
|
|
|
has 'ignore_name' => ( |
|
134
|
|
|
|
|
|
|
is => 'ro', |
|
135
|
|
|
|
|
|
|
isa => 'Bool', |
|
136
|
|
|
|
|
|
|
required => 1, |
|
137
|
|
|
|
|
|
|
lazy => 1, |
|
138
|
|
|
|
|
|
|
default => 0, |
|
139
|
|
|
|
|
|
|
); |
|
140
|
|
|
|
|
|
|
|
|
141
|
|
|
|
|
|
|
1; |
|
142
|
|
|
|
|
|
|
|
|
143
|
|
|
|
|
|
|
################################################################## |
|
144
|
|
|
|
|
|
|
package StorageDisplay::Role::WithName; |
|
145
|
|
|
|
|
|
|
|
|
146
|
1
|
|
|
1
|
|
7
|
use Moose::Role; |
|
|
1
|
|
|
|
|
3
|
|
|
|
1
|
|
|
|
|
4
|
|
|
147
|
|
|
|
|
|
|
|
|
148
|
|
|
|
|
|
|
requires 'name'; |
|
149
|
|
|
|
|
|
|
|
|
150
|
|
|
|
|
|
|
1; |
|
151
|
|
|
|
|
|
|
|
|
152
|
|
|
|
|
|
|
################################################################## |
|
153
|
|
|
|
|
|
|
package StorageDisplay::Role::Iterable; |
|
154
|
|
|
|
|
|
|
|
|
155
|
1
|
|
|
1
|
|
5649
|
use MooseX::Role::Parameterized; |
|
|
1
|
|
|
|
|
83963
|
|
|
|
1
|
|
|
|
|
5
|
|
|
156
|
1
|
|
|
1
|
|
39852
|
use Types::Standard qw(Enum); |
|
|
1
|
|
|
|
|
73792
|
|
|
|
1
|
|
|
|
|
13
|
|
|
157
|
|
|
|
|
|
|
|
|
158
|
1
|
|
|
1
|
|
864
|
use Carp; |
|
|
1
|
|
|
|
|
2
|
|
|
|
1
|
|
|
|
|
1426
|
|
|
159
|
|
|
|
|
|
|
|
|
160
|
|
|
|
|
|
|
parameter iterable => ( |
|
161
|
|
|
|
|
|
|
isa => 'Str', |
|
162
|
|
|
|
|
|
|
required => 1, |
|
163
|
|
|
|
|
|
|
); |
|
164
|
|
|
|
|
|
|
|
|
165
|
|
|
|
|
|
|
parameter _kindname => ( |
|
166
|
|
|
|
|
|
|
is => 'ro', |
|
167
|
|
|
|
|
|
|
isa => Enum[qw/Plain Recursive/], |
|
168
|
|
|
|
|
|
|
init_arg => 'name', |
|
169
|
|
|
|
|
|
|
required => 1, |
|
170
|
|
|
|
|
|
|
#default => "Plain", |
|
171
|
|
|
|
|
|
|
); |
|
172
|
|
|
|
|
|
|
|
|
173
|
|
|
|
|
|
|
role { |
|
174
|
|
|
|
|
|
|
my $p = shift; |
|
175
|
|
|
|
|
|
|
my $role_provide = "StorageDisplay::Role::ProvideName::".$p->_kindname; |
|
176
|
|
|
|
|
|
|
|
|
177
|
|
|
|
|
|
|
with ( |
|
178
|
|
|
|
|
|
|
$role_provide, |
|
179
|
|
|
|
|
|
|
"StorageDisplay::Role::WithName", |
|
180
|
|
|
|
|
|
|
); |
|
181
|
|
|
|
|
|
|
|
|
182
|
|
|
|
|
|
|
my $iterable = $p->iterable; |
|
183
|
|
|
|
|
|
|
my $iterator = $iterable.'::Iterator'; |
|
184
|
|
|
|
|
|
|
my $iteratorframe = $iterator.'::Frame'; |
|
185
|
|
|
|
|
|
|
|
|
186
|
|
|
|
|
|
|
has '_parents' => ( |
|
187
|
|
|
|
|
|
|
traits => [ 'Hash' ], |
|
188
|
|
|
|
|
|
|
is => 'ro', |
|
189
|
|
|
|
|
|
|
isa => "HashRef[$iterable]", |
|
190
|
|
|
|
|
|
|
required => 1, |
|
191
|
|
|
|
|
|
|
default => sub { return {}; }, |
|
192
|
|
|
|
|
|
|
handles => { |
|
193
|
|
|
|
|
|
|
'_add_parents' => 'set', |
|
194
|
|
|
|
|
|
|
'hasParent' => 'exists', |
|
195
|
|
|
|
|
|
|
'_getParent' => 'get', |
|
196
|
|
|
|
|
|
|
} |
|
197
|
|
|
|
|
|
|
); |
|
198
|
|
|
|
|
|
|
|
|
199
|
|
|
|
|
|
|
has '_parents_tab' => ( |
|
200
|
|
|
|
|
|
|
traits => [ 'Array' ], |
|
201
|
|
|
|
|
|
|
is => 'ro', |
|
202
|
|
|
|
|
|
|
isa => "ArrayRef[$iterable]", |
|
203
|
|
|
|
|
|
|
required => 1, |
|
204
|
|
|
|
|
|
|
default => sub { return []; }, |
|
205
|
|
|
|
|
|
|
handles => { |
|
206
|
|
|
|
|
|
|
'_add_parents_tab' => 'push', |
|
207
|
|
|
|
|
|
|
'parents' => 'elements', |
|
208
|
|
|
|
|
|
|
'nb_parents' => 'count', |
|
209
|
|
|
|
|
|
|
} |
|
210
|
|
|
|
|
|
|
); |
|
211
|
|
|
|
|
|
|
|
|
212
|
|
|
|
|
|
|
method "_addParent" => sub { |
|
213
|
0
|
|
|
0
|
|
|
my $self = shift; |
|
214
|
0
|
|
|
|
|
|
my $parent = shift; |
|
215
|
0
|
|
|
|
|
|
my $parent_name = $parent->name; |
|
216
|
0
|
0
|
|
|
|
|
if ($self->hasParent($parent_name)) { |
|
217
|
0
|
0
|
|
|
|
|
if ($parent != $self->_getParent($parent_name)) { |
|
218
|
0
|
|
|
|
|
|
croak "Two different parents with name $parent_name for ".$self->name; |
|
219
|
|
|
|
|
|
|
} |
|
220
|
|
|
|
|
|
|
} else { |
|
221
|
0
|
|
|
|
|
|
$self->_add_parents($parent_name, $parent); |
|
222
|
0
|
|
|
|
|
|
$self->_add_parents_tab($parent); |
|
223
|
|
|
|
|
|
|
} |
|
224
|
|
|
|
|
|
|
}; |
|
225
|
|
|
|
|
|
|
|
|
226
|
|
|
|
|
|
|
has '_children' => ( |
|
227
|
|
|
|
|
|
|
traits => [ 'Hash' ], |
|
228
|
|
|
|
|
|
|
is => 'ro', |
|
229
|
|
|
|
|
|
|
isa => "HashRef[$iterable]", |
|
230
|
|
|
|
|
|
|
required => 1, |
|
231
|
|
|
|
|
|
|
default => sub { return {}; }, |
|
232
|
|
|
|
|
|
|
handles => { |
|
233
|
|
|
|
|
|
|
'_addChild' => 'set', |
|
234
|
|
|
|
|
|
|
'hasChild' => 'exists', |
|
235
|
|
|
|
|
|
|
'_getChild' => 'get', |
|
236
|
|
|
|
|
|
|
} |
|
237
|
|
|
|
|
|
|
); |
|
238
|
|
|
|
|
|
|
|
|
239
|
|
|
|
|
|
|
has '_children_tab' => ( |
|
240
|
|
|
|
|
|
|
traits => [ 'Array' ], |
|
241
|
|
|
|
|
|
|
is => 'ro', |
|
242
|
|
|
|
|
|
|
isa => "ArrayRef[$iterable]", |
|
243
|
|
|
|
|
|
|
required => 1, |
|
244
|
|
|
|
|
|
|
default => sub { return []; }, |
|
245
|
|
|
|
|
|
|
handles => { |
|
246
|
|
|
|
|
|
|
'_addChild_tab' => 'push', |
|
247
|
|
|
|
|
|
|
'children' => 'elements', |
|
248
|
|
|
|
|
|
|
} |
|
249
|
|
|
|
|
|
|
); |
|
250
|
|
|
|
|
|
|
|
|
251
|
|
|
|
|
|
|
method "addChild" => sub { |
|
252
|
0
|
|
|
0
|
|
|
my $self = shift; |
|
253
|
0
|
|
|
|
|
|
my $child = shift; |
|
254
|
0
|
|
|
|
|
|
my $child_name = $child->name; |
|
255
|
0
|
0
|
|
|
|
|
if ($self->hasChild($child_name)) { |
|
256
|
0
|
0
|
|
|
|
|
if ($child != $self->_getChild($child_name)) { |
|
257
|
0
|
|
|
|
|
|
croak "Two different children with name $child_name for ".$self->name; |
|
258
|
|
|
|
|
|
|
} |
|
259
|
|
|
|
|
|
|
} else { |
|
260
|
0
|
|
|
|
|
|
$self->_addChild($child_name, $child); |
|
261
|
0
|
|
|
|
|
|
$self->_addChild_tab($child); |
|
262
|
|
|
|
|
|
|
} |
|
263
|
0
|
|
|
|
|
|
$child->_addParent($self); |
|
264
|
0
|
|
|
|
|
|
return $child; |
|
265
|
|
|
|
|
|
|
}; |
|
266
|
|
|
|
|
|
|
|
|
267
|
|
|
|
|
|
|
method "iterator" => sub { |
|
268
|
0
|
|
|
0
|
|
|
my $self = shift; |
|
269
|
|
|
|
|
|
|
|
|
270
|
0
|
|
|
|
|
|
return "$iterator"->new( |
|
271
|
|
|
|
|
|
|
$self, |
|
272
|
|
|
|
|
|
|
@_, |
|
273
|
|
|
|
|
|
|
); |
|
274
|
|
|
|
|
|
|
}; |
|
275
|
|
|
|
|
|
|
###################################################### |
|
276
|
|
|
|
|
|
|
###################################################### |
|
277
|
|
|
|
|
|
|
# ::Iterator class |
|
278
|
|
|
|
|
|
|
my $iteratorclass = Moose::Meta::Class->create( |
|
279
|
|
|
|
|
|
|
$iterator, |
|
280
|
|
|
|
|
|
|
#attributes => [], |
|
281
|
|
|
|
|
|
|
#roles => [], |
|
282
|
|
|
|
|
|
|
#methods => {}, |
|
283
|
|
|
|
|
|
|
superclasses => ["Moose::Object"], |
|
284
|
|
|
|
|
|
|
); |
|
285
|
|
|
|
|
|
|
|
|
286
|
|
|
|
|
|
|
$iteratorclass->add_attribute( |
|
287
|
|
|
|
|
|
|
'recurse' => ( |
|
288
|
|
|
|
|
|
|
is => 'ro', |
|
289
|
|
|
|
|
|
|
isa => 'Bool', |
|
290
|
|
|
|
|
|
|
required => 1, |
|
291
|
|
|
|
|
|
|
default => 1, |
|
292
|
|
|
|
|
|
|
)); |
|
293
|
|
|
|
|
|
|
$iteratorclass->add_attribute( |
|
294
|
|
|
|
|
|
|
'with-self' => ( |
|
295
|
|
|
|
|
|
|
is => 'bare', |
|
296
|
|
|
|
|
|
|
reader => 'with_self', |
|
297
|
|
|
|
|
|
|
isa => 'Bool', |
|
298
|
|
|
|
|
|
|
required => 1, |
|
299
|
|
|
|
|
|
|
default => 0, |
|
300
|
|
|
|
|
|
|
)); |
|
301
|
|
|
|
|
|
|
$iteratorclass->add_attribute( |
|
302
|
|
|
|
|
|
|
'_seen' => ( |
|
303
|
|
|
|
|
|
|
traits => [ 'Hash' ], |
|
304
|
|
|
|
|
|
|
is => 'ro', |
|
305
|
|
|
|
|
|
|
isa => 'HashRef[Bool]', |
|
306
|
|
|
|
|
|
|
required => 1, |
|
307
|
|
|
|
|
|
|
default => sub { return {}; }, |
|
308
|
|
|
|
|
|
|
handles => { |
|
309
|
|
|
|
|
|
|
'_found' => 'exists', |
|
310
|
|
|
|
|
|
|
'_mark' => 'set', |
|
311
|
|
|
|
|
|
|
} |
|
312
|
|
|
|
|
|
|
)); |
|
313
|
|
|
|
|
|
|
$iteratorclass->add_attribute( |
|
314
|
|
|
|
|
|
|
'uniq' => ( |
|
315
|
|
|
|
|
|
|
is => 'ro', |
|
316
|
|
|
|
|
|
|
isa => 'Bool', |
|
317
|
|
|
|
|
|
|
required => 1, |
|
318
|
|
|
|
|
|
|
default => 0, |
|
319
|
|
|
|
|
|
|
)); |
|
320
|
|
|
|
|
|
|
$iteratorclass->add_attribute( |
|
321
|
|
|
|
|
|
|
'postfix' => ( |
|
322
|
|
|
|
|
|
|
is => 'ro', |
|
323
|
|
|
|
|
|
|
isa => 'Bool', |
|
324
|
|
|
|
|
|
|
required => 1, |
|
325
|
|
|
|
|
|
|
default => 0, |
|
326
|
|
|
|
|
|
|
)); |
|
327
|
|
|
|
|
|
|
$iteratorclass->add_attribute( |
|
328
|
|
|
|
|
|
|
'_stack_frame' => ( |
|
329
|
|
|
|
|
|
|
traits => [ 'Array' ], |
|
330
|
|
|
|
|
|
|
is => 'ro', |
|
331
|
|
|
|
|
|
|
isa => "ArrayRef[$iteratorframe]", |
|
332
|
|
|
|
|
|
|
required => 1, |
|
333
|
|
|
|
|
|
|
default => sub { return []; }, |
|
334
|
|
|
|
|
|
|
handles => { |
|
335
|
|
|
|
|
|
|
'_push_frame' => 'push', |
|
336
|
|
|
|
|
|
|
'_pop_frame' => 'pop', |
|
337
|
|
|
|
|
|
|
} |
|
338
|
|
|
|
|
|
|
)); |
|
339
|
|
|
|
|
|
|
$iteratorclass->add_attribute( |
|
340
|
|
|
|
|
|
|
'_init_block' => ( |
|
341
|
|
|
|
|
|
|
is => 'ro', |
|
342
|
|
|
|
|
|
|
isa => $iterable, |
|
343
|
|
|
|
|
|
|
required => 1, |
|
344
|
|
|
|
|
|
|
)); |
|
345
|
|
|
|
|
|
|
$iteratorclass->add_attribute( |
|
346
|
|
|
|
|
|
|
'_cur_frame' => ( |
|
347
|
|
|
|
|
|
|
is => 'rw', |
|
348
|
|
|
|
|
|
|
isa => "Maybe[$iteratorframe]", |
|
349
|
|
|
|
|
|
|
required => 1, |
|
350
|
|
|
|
|
|
|
lazy => 1, |
|
351
|
|
|
|
|
|
|
default => sub { |
|
352
|
|
|
|
|
|
|
my $self = shift; |
|
353
|
|
|
|
|
|
|
return $iteratorframe->new( |
|
354
|
|
|
|
|
|
|
$self->_init_block, |
|
355
|
|
|
|
|
|
|
$self, |
|
356
|
|
|
|
|
|
|
); |
|
357
|
|
|
|
|
|
|
}, |
|
358
|
|
|
|
|
|
|
)); |
|
359
|
|
|
|
|
|
|
$iteratorclass->add_attribute( |
|
360
|
|
|
|
|
|
|
'_next_computed' => ( |
|
361
|
|
|
|
|
|
|
is => 'rw', |
|
362
|
|
|
|
|
|
|
isa => 'Bool', |
|
363
|
|
|
|
|
|
|
required => 0, |
|
364
|
|
|
|
|
|
|
default => 0, |
|
365
|
|
|
|
|
|
|
)); |
|
366
|
|
|
|
|
|
|
$iteratorclass->add_attribute( |
|
367
|
|
|
|
|
|
|
'_next' => ( |
|
368
|
|
|
|
|
|
|
is => 'rw', |
|
369
|
|
|
|
|
|
|
isa => "Maybe[$iterable]", |
|
370
|
|
|
|
|
|
|
required => 0, |
|
371
|
|
|
|
|
|
|
default => undef, |
|
372
|
|
|
|
|
|
|
)); |
|
373
|
|
|
|
|
|
|
$iteratorclass->add_method( |
|
374
|
|
|
|
|
|
|
'has_next' => sub { |
|
375
|
0
|
|
|
0
|
|
|
my $self = shift; |
|
376
|
0
|
0
|
|
|
|
|
if (! $self->_next_computed) { |
|
377
|
0
|
|
|
|
|
|
$self->_compute_next; |
|
378
|
|
|
|
|
|
|
} |
|
379
|
0
|
|
|
|
|
|
return defined($self->_next); |
|
380
|
|
|
|
|
|
|
}); |
|
381
|
|
|
|
|
|
|
$iteratorclass->add_method( |
|
382
|
|
|
|
|
|
|
'next' => sub { |
|
383
|
0
|
|
|
0
|
|
|
my $self = shift; |
|
384
|
0
|
0
|
|
|
|
|
if (! $self->_next_computed) { |
|
385
|
0
|
|
|
|
|
|
$self->_compute_next; |
|
386
|
|
|
|
|
|
|
} |
|
387
|
0
|
|
|
|
|
|
$self->_next_computed(0); |
|
388
|
0
|
|
|
|
|
|
return $self->_next; |
|
389
|
|
|
|
|
|
|
}); |
|
390
|
|
|
|
|
|
|
$iteratorclass->add_attribute( |
|
391
|
|
|
|
|
|
|
'filter' => ( |
|
392
|
|
|
|
|
|
|
traits => ['Code'], |
|
393
|
|
|
|
|
|
|
is => 'ro', |
|
394
|
|
|
|
|
|
|
isa => 'CodeRef', |
|
395
|
|
|
|
|
|
|
default => sub { |
|
396
|
|
|
|
|
|
|
sub { 1; } |
|
397
|
|
|
|
|
|
|
}, |
|
398
|
|
|
|
|
|
|
handles => { |
|
399
|
|
|
|
|
|
|
do_filter => 'execute', |
|
400
|
|
|
|
|
|
|
}, |
|
401
|
|
|
|
|
|
|
)); |
|
402
|
|
|
|
|
|
|
$iteratorclass->add_method( |
|
403
|
|
|
|
|
|
|
'_compute_next' => sub { |
|
404
|
0
|
|
|
0
|
|
|
my $self = shift; |
|
405
|
|
|
|
|
|
|
|
|
406
|
0
|
|
|
|
|
|
$self->_next_computed(1); |
|
407
|
0
|
0
|
|
|
|
|
if (!defined($self->_cur_frame)) { |
|
408
|
0
|
|
|
|
|
|
$self->_next(undef); |
|
409
|
0
|
|
|
|
|
|
return; |
|
410
|
|
|
|
|
|
|
} |
|
411
|
|
|
|
|
|
|
#print STDERR "****\nBegin compute: ", $self->_cur_frame->dump, "\n"; |
|
412
|
0
|
|
0
|
|
|
|
do { |
|
|
|
|
0
|
|
|
|
|
|
413
|
0
|
|
0
|
|
|
|
do { |
|
414
|
0
|
|
|
|
|
|
my $n = $self->_cur_frame->next_child; |
|
415
|
0
|
|
|
|
|
|
while (! defined($n)) { |
|
416
|
|
|
|
|
|
|
# nothing more in this frame. Poping it. |
|
417
|
0
|
|
|
|
|
|
my $cur_frame = $self->_cur_frame; |
|
418
|
0
|
|
|
|
|
|
$self->_cur_frame($self->_pop_frame); |
|
419
|
0
|
0
|
|
|
|
|
if ($self->postfix) { |
|
420
|
0
|
|
|
|
|
|
$n=$cur_frame->current; |
|
421
|
|
|
|
|
|
|
#print STDERR "Poping frame and found: ", $n->name, "\n"; |
|
422
|
0
|
0
|
|
|
|
|
if ($n == $self->_init_block) { |
|
423
|
0
|
|
|
|
|
|
$self->_next(undef); |
|
424
|
0
|
|
|
|
|
|
return; |
|
425
|
|
|
|
|
|
|
} |
|
426
|
0
|
|
|
|
|
|
$self->_next($n); |
|
427
|
0
|
|
|
|
|
|
$n=undef; |
|
428
|
0
|
|
|
|
|
|
last; |
|
429
|
|
|
|
|
|
|
} else { |
|
430
|
0
|
0
|
|
|
|
|
if (!defined($self->_cur_frame)) { |
|
431
|
0
|
|
|
|
|
|
$self->_next(undef); |
|
432
|
0
|
|
|
|
|
|
return; |
|
433
|
|
|
|
|
|
|
} |
|
434
|
|
|
|
|
|
|
#print STDERR "Poping frame: ", $self->_cur_frame->dump, "\n"; |
|
435
|
0
|
|
|
|
|
|
$n = $self->_cur_frame->next_child; |
|
436
|
|
|
|
|
|
|
} |
|
437
|
|
|
|
|
|
|
} |
|
438
|
0
|
|
|
|
|
|
while (defined($n)) { |
|
439
|
|
|
|
|
|
|
# $n : next in _cur_frame |
|
440
|
0
|
|
|
|
|
|
my @children = ($n->children); |
|
441
|
0
|
0
|
0
|
|
|
|
if (! $self->recurse || scalar(@children) == 0) { |
|
442
|
|
|
|
|
|
|
# no children for current node (or no recursion), just using it and go |
|
443
|
0
|
|
|
|
|
|
$self->_next($n); |
|
444
|
|
|
|
|
|
|
#print STDERR "Found no children: ", $n->name, "\n"; |
|
445
|
0
|
|
|
|
|
|
last; |
|
446
|
|
|
|
|
|
|
} else { |
|
447
|
|
|
|
|
|
|
# Building new frame |
|
448
|
0
|
|
|
|
|
|
my $new_frame = $iteratorframe->new( |
|
449
|
|
|
|
|
|
|
$n, |
|
450
|
|
|
|
|
|
|
$self, |
|
451
|
|
|
|
|
|
|
); |
|
452
|
|
|
|
|
|
|
#print STDERR "Building new frame: ", $new_frame->dump, "\n"; |
|
453
|
0
|
|
|
|
|
|
$self->_push_frame($self->_cur_frame); |
|
454
|
0
|
|
|
|
|
|
$self->_cur_frame($new_frame); |
|
455
|
0
|
0
|
|
|
|
|
if (! $self->postfix) { |
|
456
|
0
|
|
|
|
|
|
$self->_next($n); |
|
457
|
0
|
|
|
|
|
|
last; |
|
458
|
|
|
|
|
|
|
} else { |
|
459
|
0
|
|
|
|
|
|
$n = $new_frame->next_child; |
|
460
|
|
|
|
|
|
|
} |
|
461
|
|
|
|
|
|
|
} |
|
462
|
|
|
|
|
|
|
} |
|
463
|
|
|
|
|
|
|
} while ($self->uniq && $self->_found($self->_next)); |
|
464
|
0
|
|
|
|
|
|
$self->_mark($self->_next, 1); |
|
465
|
|
|
|
|
|
|
#FIXME# if not a real bloc, accept it |
|
466
|
|
|
|
|
|
|
#last if not $self->_next->isa($iterable); |
|
467
|
|
|
|
|
|
|
} while ( |
|
468
|
|
|
|
|
|
|
($self->with_self || $self->_next != $self->_init_block) |
|
469
|
|
|
|
|
|
|
&& !$self->do_filter($self->_next) |
|
470
|
|
|
|
|
|
|
); |
|
471
|
|
|
|
|
|
|
|
|
472
|
|
|
|
|
|
|
|
|
473
|
|
|
|
|
|
|
#if ($self->has_next) { |
|
474
|
|
|
|
|
|
|
# print STDERR "Found: ", $self->_next->name, "\n"; |
|
475
|
|
|
|
|
|
|
#} |
|
476
|
|
|
|
|
|
|
#use Data::Dumper; |
|
477
|
|
|
|
|
|
|
#$Data::Dumper::Maxdepth = 3; |
|
478
|
|
|
|
|
|
|
#print STDERR Dumper($self); |
|
479
|
|
|
|
|
|
|
}); |
|
480
|
|
|
|
|
|
|
$iteratorclass->add_around_method_modifier( |
|
481
|
|
|
|
|
|
|
'BUILDARGS' => sub { |
|
482
|
|
|
|
|
|
|
my $orig = shift; |
|
483
|
|
|
|
|
|
|
my $class = shift; |
|
484
|
|
|
|
|
|
|
my $init_block = shift; |
|
485
|
|
|
|
|
|
|
my %args = (@_); |
|
486
|
|
|
|
|
|
|
|
|
487
|
|
|
|
|
|
|
return $class->$orig( |
|
488
|
|
|
|
|
|
|
@_, |
|
489
|
|
|
|
|
|
|
'_init_block' => $init_block, |
|
490
|
|
|
|
|
|
|
); |
|
491
|
|
|
|
|
|
|
}); |
|
492
|
|
|
|
|
|
|
###################################################### |
|
493
|
|
|
|
|
|
|
###################################################### |
|
494
|
|
|
|
|
|
|
# ::Iterator::Frame class |
|
495
|
|
|
|
|
|
|
my $iteratorframeclass = Moose::Meta::Class->create( |
|
496
|
|
|
|
|
|
|
$iteratorframe, |
|
497
|
|
|
|
|
|
|
#attributes => [], |
|
498
|
|
|
|
|
|
|
#roles => [], |
|
499
|
|
|
|
|
|
|
#methods => {}, |
|
500
|
|
|
|
|
|
|
superclasses => ["Moose::Object"], |
|
501
|
|
|
|
|
|
|
); |
|
502
|
|
|
|
|
|
|
$iteratorframeclass->add_attribute( |
|
503
|
|
|
|
|
|
|
'current' => ( |
|
504
|
|
|
|
|
|
|
is => 'ro', |
|
505
|
|
|
|
|
|
|
isa => $iterable, |
|
506
|
|
|
|
|
|
|
required => 1, |
|
507
|
|
|
|
|
|
|
)); |
|
508
|
|
|
|
|
|
|
$iteratorframeclass->add_attribute( |
|
509
|
|
|
|
|
|
|
'_children' => ( |
|
510
|
|
|
|
|
|
|
traits => [ 'Array' ], |
|
511
|
|
|
|
|
|
|
is => 'ro', |
|
512
|
|
|
|
|
|
|
isa => "ArrayRef[$iterable]", |
|
513
|
|
|
|
|
|
|
required => 1, |
|
514
|
|
|
|
|
|
|
handles => { |
|
515
|
|
|
|
|
|
|
'next_child' => 'shift', |
|
516
|
|
|
|
|
|
|
'_all_children' => 'elements', |
|
517
|
|
|
|
|
|
|
} |
|
518
|
|
|
|
|
|
|
)); |
|
519
|
|
|
|
|
|
|
$iteratorframeclass->add_attribute( |
|
520
|
|
|
|
|
|
|
'it' => ( |
|
521
|
|
|
|
|
|
|
is => 'ro', |
|
522
|
|
|
|
|
|
|
isa => $iterator, |
|
523
|
|
|
|
|
|
|
required => 1, |
|
524
|
|
|
|
|
|
|
)); |
|
525
|
|
|
|
|
|
|
$iteratorframeclass->add_around_method_modifier( |
|
526
|
|
|
|
|
|
|
'BUILDARGS' => sub { |
|
527
|
|
|
|
|
|
|
my $orig = shift; |
|
528
|
|
|
|
|
|
|
my $class = shift; |
|
529
|
|
|
|
|
|
|
my $current = shift; |
|
530
|
|
|
|
|
|
|
my $it = shift; |
|
531
|
|
|
|
|
|
|
|
|
532
|
|
|
|
|
|
|
return $class->$orig( |
|
533
|
|
|
|
|
|
|
'current' => $current, |
|
534
|
|
|
|
|
|
|
'it' => $it, |
|
535
|
|
|
|
|
|
|
'_children' => [ $current->children ], |
|
536
|
|
|
|
|
|
|
@_ |
|
537
|
|
|
|
|
|
|
); |
|
538
|
|
|
|
|
|
|
}); |
|
539
|
|
|
|
|
|
|
}; |
|
540
|
|
|
|
|
|
|
|
|
541
|
|
|
|
|
|
|
1; |
|
542
|
|
|
|
|
|
|
|
|
543
|
|
|
|
|
|
|
package StorageDisplay::Role::Elem::Kind; |
|
544
|
|
|
|
|
|
|
|
|
545
|
1
|
|
|
1
|
|
9
|
use MooseX::Role::Parameterized; |
|
|
1
|
|
|
|
|
2
|
|
|
|
1
|
|
|
|
|
12
|
|
|
546
|
|
|
|
|
|
|
|
|
547
|
|
|
|
|
|
|
parameter kind => ( |
|
548
|
|
|
|
|
|
|
isa => 'Str', |
|
549
|
|
|
|
|
|
|
required => 1, |
|
550
|
|
|
|
|
|
|
); |
|
551
|
|
|
|
|
|
|
|
|
552
|
|
|
|
|
|
|
role { |
|
553
|
|
|
|
|
|
|
my $role = shift; |
|
554
|
|
|
|
|
|
|
|
|
555
|
|
|
|
|
|
|
my $kind = $role->kind; |
|
556
|
|
|
|
|
|
|
|
|
557
|
|
|
|
|
|
|
around 'BUILDARGS' => sub { |
|
558
|
|
|
|
|
|
|
my $orig = shift; |
|
559
|
|
|
|
|
|
|
my $class = shift; |
|
560
|
|
|
|
|
|
|
|
|
561
|
|
|
|
|
|
|
return $class->$orig(@_, 'name_prefix' => $kind); |
|
562
|
|
|
|
|
|
|
}; |
|
563
|
|
|
|
|
|
|
}; |
|
564
|
|
|
|
|
|
|
|
|
565
|
|
|
|
|
|
|
1; |
|
566
|
|
|
|
|
|
|
|
|
567
|
|
|
|
|
|
|
################################################################## |
|
568
|
|
|
|
|
|
|
package StorageDisplay::Role::HasBlock; |
|
569
|
|
|
|
|
|
|
|
|
570
|
1
|
|
|
1
|
|
11228
|
use Moose::Role; |
|
|
1
|
|
|
|
|
3
|
|
|
|
1
|
|
|
|
|
16
|
|
|
571
|
|
|
|
|
|
|
|
|
572
|
|
|
|
|
|
|
has 'block' => ( |
|
573
|
|
|
|
|
|
|
is => 'ro', |
|
574
|
|
|
|
|
|
|
isa => 'StorageDisplay::Block', |
|
575
|
|
|
|
|
|
|
required => 1, |
|
576
|
|
|
|
|
|
|
); |
|
577
|
|
|
|
|
|
|
|
|
578
|
|
|
|
|
|
|
1; |
|
579
|
|
|
|
|
|
|
|
|
580
|
|
|
|
|
|
|
################################################################## |
|
581
|
|
|
|
|
|
|
package StorageDisplay::Role::Style::Base; |
|
582
|
|
|
|
|
|
|
|
|
583
|
1
|
|
|
1
|
|
5170
|
use Moose::Role; |
|
|
1
|
|
|
|
|
3
|
|
|
|
1
|
|
|
|
|
13
|
|
|
584
|
|
|
|
|
|
|
|
|
585
|
|
|
|
|
|
|
1; |
|
586
|
|
|
|
|
|
|
|
|
587
|
|
|
|
|
|
|
################################################################## |
|
588
|
|
|
|
|
|
|
package StorageDisplay::Role::Style::Base::Elem; |
|
589
|
|
|
|
|
|
|
|
|
590
|
1
|
|
|
1
|
|
5105
|
use Moose::Role; |
|
|
1
|
|
|
|
|
3
|
|
|
|
1
|
|
|
|
|
5
|
|
|
591
|
|
|
|
|
|
|
|
|
592
|
1
|
|
|
1
|
|
5187
|
use Carp; |
|
|
1
|
|
|
|
|
3
|
|
|
|
1
|
|
|
|
|
829
|
|
|
593
|
|
|
|
|
|
|
|
|
594
|
|
|
|
|
|
|
sub dotJoinStyle { |
|
595
|
0
|
|
|
0
|
0
|
|
my $self = shift; |
|
596
|
0
|
|
0
|
|
|
|
my $t = shift // "\t"; |
|
597
|
|
|
|
|
|
|
|
|
598
|
0
|
|
|
|
|
|
return join(';', grep { defined($_) } @_); |
|
|
0
|
|
|
|
|
|
|
|
599
|
|
|
|
|
|
|
} |
|
600
|
|
|
|
|
|
|
|
|
601
|
|
|
|
|
|
|
sub dotIndent { |
|
602
|
0
|
|
|
0
|
0
|
|
my $self = shift; |
|
603
|
0
|
|
0
|
|
|
|
my $t = shift // "\t"; |
|
604
|
|
|
|
|
|
|
|
|
605
|
0
|
|
|
|
|
|
return map { $t.$_ } @_; |
|
|
0
|
|
|
|
|
|
|
|
606
|
|
|
|
|
|
|
} |
|
607
|
|
|
|
|
|
|
|
|
608
|
|
|
|
|
|
|
sub dotLabel { |
|
609
|
0
|
|
|
0
|
0
|
|
my $self = shift; |
|
610
|
0
|
|
|
|
|
|
return ($self->_dotDefaultLabel(@_)); |
|
611
|
|
|
|
|
|
|
} |
|
612
|
|
|
|
|
|
|
|
|
613
|
|
|
|
|
|
|
sub dotFullLabel { |
|
614
|
0
|
|
|
0
|
0
|
|
my $self = shift; |
|
615
|
0
|
|
|
|
|
|
return $self->_dotDefaultFullLabel(@_); |
|
616
|
|
|
|
|
|
|
} |
|
617
|
|
|
|
|
|
|
|
|
618
|
|
|
|
|
|
|
sub dotNode { |
|
619
|
0
|
|
|
0
|
0
|
|
my $self = shift; |
|
620
|
|
|
|
|
|
|
#print STDERR "dotNode in ".__PACKAGE__." for ".$self->name."\n"; |
|
621
|
0
|
|
|
|
|
|
return $self->_dotDefaultNode(@_); |
|
622
|
|
|
|
|
|
|
} |
|
623
|
|
|
|
|
|
|
|
|
624
|
|
|
|
|
|
|
sub dotStyleNode { |
|
625
|
0
|
|
|
0
|
0
|
|
my $self = shift; |
|
626
|
0
|
|
|
|
|
|
return $self->_dotDefaultStyleNode(@_); |
|
627
|
|
|
|
|
|
|
} |
|
628
|
|
|
|
|
|
|
|
|
629
|
|
|
|
|
|
|
sub dotStyleNodeState { |
|
630
|
0
|
|
|
0
|
0
|
|
my $self = shift; |
|
631
|
|
|
|
|
|
|
|
|
632
|
0
|
|
|
|
|
|
return $self->_dotDefaultStyleNodeState; |
|
633
|
|
|
|
|
|
|
} |
|
634
|
|
|
|
|
|
|
|
|
635
|
|
|
|
|
|
|
sub dotFormatedFullLabel { |
|
636
|
0
|
|
|
0
|
0
|
|
my $self = shift; |
|
637
|
0
|
|
|
|
|
|
my $t = shift; |
|
638
|
|
|
|
|
|
|
|
|
639
|
|
|
|
|
|
|
return join($self->_dotLabelNL, |
|
640
|
0
|
|
|
|
|
|
grep {defined($_)} $self->dotFullLabel); |
|
|
0
|
|
|
|
|
|
|
|
641
|
|
|
|
|
|
|
} |
|
642
|
|
|
|
|
|
|
|
|
643
|
|
|
|
|
|
|
# default implementations |
|
644
|
|
|
|
|
|
|
|
|
645
|
|
|
|
|
|
|
# will be overrided when a Table is generated |
|
646
|
|
|
|
|
|
|
sub _dotTableLabel { |
|
647
|
0
|
|
|
0
|
|
|
my $self = shift; |
|
648
|
0
|
|
|
|
|
|
return $self->dotFormatedFullLabel(@_); |
|
649
|
|
|
|
|
|
|
} |
|
650
|
|
|
|
|
|
|
|
|
651
|
|
|
|
|
|
|
sub _dotDefaultLabel { |
|
652
|
0
|
|
|
0
|
|
|
my $self = shift; |
|
653
|
0
|
|
|
|
|
|
return ($self->name); |
|
654
|
|
|
|
|
|
|
} |
|
655
|
|
|
|
|
|
|
|
|
656
|
|
|
|
|
|
|
sub _dotDefaultStyleNodeState { |
|
657
|
0
|
|
|
0
|
|
|
my $self = shift; |
|
658
|
|
|
|
|
|
|
|
|
659
|
0
|
|
|
|
|
|
return (); |
|
660
|
|
|
|
|
|
|
} |
|
661
|
|
|
|
|
|
|
|
|
662
|
|
|
|
|
|
|
sub _dotDefaultStyleNode { |
|
663
|
0
|
|
|
0
|
|
|
my $self = shift; |
|
664
|
0
|
|
|
|
|
|
my @style = grep { $_ !~ m/[node]/ } $self->dotStyle(@_); |
|
|
0
|
|
|
|
|
|
|
|
665
|
|
|
|
|
|
|
|
|
666
|
0
|
|
|
|
|
|
push @style, $self->dotStyleNodeState(@_); |
|
667
|
0
|
|
|
|
|
|
return @style; |
|
668
|
|
|
|
|
|
|
} |
|
669
|
|
|
|
|
|
|
|
|
670
|
|
|
|
|
|
|
sub _dotLabelNL { |
|
671
|
0
|
|
|
0
|
|
|
my $self = shift; |
|
672
|
0
|
|
|
|
|
|
return '\n'; |
|
673
|
|
|
|
|
|
|
} |
|
674
|
|
|
|
|
|
|
|
|
675
|
|
|
|
|
|
|
# will be overrided with Size, Used, Free infos |
|
676
|
|
|
|
|
|
|
sub _dotDefaultFullLabel { |
|
677
|
0
|
|
|
0
|
|
|
my $self = shift; |
|
678
|
|
|
|
|
|
|
|
|
679
|
0
|
|
|
|
|
|
return ($self->dotLabel(@_)); |
|
680
|
|
|
|
|
|
|
} |
|
681
|
|
|
|
|
|
|
|
|
682
|
|
|
|
|
|
|
# will be overrided for HTML |
|
683
|
|
|
|
|
|
|
sub _dotDefaultLabelLine { |
|
684
|
0
|
|
|
0
|
|
|
my $self = shift; |
|
685
|
0
|
|
|
|
|
|
my @label = $self->dotFormatedFullLabel(@_); |
|
686
|
0
|
0
|
|
|
|
|
confess "Multiline formated label!" if scalar(@label) > 1; |
|
687
|
0
|
0
|
|
|
|
|
return 'label="";' if scalar(@label) == 0; |
|
688
|
|
|
|
|
|
|
|
|
689
|
0
|
|
|
|
|
|
return ('label="'.$label[0].'";'); |
|
690
|
|
|
|
|
|
|
} |
|
691
|
|
|
|
|
|
|
|
|
692
|
|
|
|
|
|
|
# will be overrided when another node kind is selected |
|
693
|
|
|
|
|
|
|
sub _dotDefaultNode { |
|
694
|
0
|
|
|
0
|
|
|
my $self = shift; |
|
695
|
0
|
|
0
|
|
|
|
my $t = shift // "\t"; |
|
696
|
|
|
|
|
|
|
|
|
697
|
|
|
|
|
|
|
#print STDERR "coucou2 from ".$self->name."\n"; |
|
698
|
0
|
|
|
|
|
|
my @text = ( |
|
699
|
|
|
|
|
|
|
"{ ".$self->linkname.' [', |
|
700
|
|
|
|
|
|
|
$self->dotIndent( |
|
701
|
|
|
|
|
|
|
$t, |
|
702
|
|
|
|
|
|
|
$self->_dotDefaultLabelLine($t, @_), |
|
703
|
|
|
|
|
|
|
$self->dotStyleNode(), |
|
704
|
|
|
|
|
|
|
), |
|
705
|
|
|
|
|
|
|
']; }', |
|
706
|
|
|
|
|
|
|
); |
|
707
|
0
|
|
|
|
|
|
return @text; |
|
708
|
|
|
|
|
|
|
} |
|
709
|
|
|
|
|
|
|
|
|
710
|
|
|
|
|
|
|
1; |
|
711
|
|
|
|
|
|
|
|
|
712
|
|
|
|
|
|
|
################################################################## |
|
713
|
|
|
|
|
|
|
package StorageDisplay::Role::Style::Base::HTML; |
|
714
|
|
|
|
|
|
|
|
|
715
|
1
|
|
|
1
|
|
9
|
use Moose::Role; |
|
|
1
|
|
|
|
|
2
|
|
|
|
1
|
|
|
|
|
20
|
|
|
716
|
|
|
|
|
|
|
|
|
717
|
|
|
|
|
|
|
around '_dotLabelNL' => sub { |
|
718
|
|
|
|
|
|
|
my $orig = shift; |
|
719
|
|
|
|
|
|
|
my $self = shift; |
|
720
|
|
|
|
|
|
|
return '<BR/>'; |
|
721
|
|
|
|
|
|
|
}; |
|
722
|
|
|
|
|
|
|
|
|
723
|
|
|
|
|
|
|
around '_dotDefaultLabelLine' => sub { |
|
724
|
|
|
|
|
|
|
my $orig = shift; |
|
725
|
|
|
|
|
|
|
my $self = shift; |
|
726
|
|
|
|
|
|
|
my $t = shift; |
|
727
|
|
|
|
|
|
|
|
|
728
|
|
|
|
|
|
|
my @text=$self->dotIndent($t, $self->_dotTableLabel($t, @_)); |
|
729
|
|
|
|
|
|
|
|
|
730
|
|
|
|
|
|
|
if (scalar(@text) == 0) { |
|
731
|
|
|
|
|
|
|
return ('label=<>;') |
|
732
|
|
|
|
|
|
|
} |
|
733
|
|
|
|
|
|
|
|
|
734
|
|
|
|
|
|
|
$text[0] =~ s/^\s+//; |
|
735
|
|
|
|
|
|
|
$text[0] = 'label=<'.$text[0]; |
|
736
|
|
|
|
|
|
|
push @text, '>;'; |
|
737
|
|
|
|
|
|
|
|
|
738
|
|
|
|
|
|
|
return @text; |
|
739
|
|
|
|
|
|
|
}; |
|
740
|
|
|
|
|
|
|
|
|
741
|
|
|
|
|
|
|
1; |
|
742
|
|
|
|
|
|
|
|
|
743
|
|
|
|
|
|
|
################################################################## |
|
744
|
|
|
|
|
|
|
package StorageDisplay::Role::Style::IsLabel; |
|
745
|
|
|
|
|
|
|
|
|
746
|
1
|
|
|
1
|
|
5275
|
use Moose::Role; |
|
|
1
|
|
|
|
|
11
|
|
|
|
1
|
|
|
|
|
6
|
|
|
747
|
|
|
|
|
|
|
|
|
748
|
|
|
|
|
|
|
with ( |
|
749
|
|
|
|
|
|
|
'StorageDisplay::Role::Style::Base', |
|
750
|
|
|
|
|
|
|
); |
|
751
|
|
|
|
|
|
|
|
|
752
|
|
|
|
|
|
|
around '_dotDefaultNode' => sub { |
|
753
|
|
|
|
|
|
|
my $orig = shift; |
|
754
|
|
|
|
|
|
|
my $self = shift; |
|
755
|
|
|
|
|
|
|
|
|
756
|
|
|
|
|
|
|
#print STDERR "coucou from ".$self->name."\n"; |
|
757
|
|
|
|
|
|
|
return $self->_dotTableLabel(@_); |
|
758
|
|
|
|
|
|
|
}; |
|
759
|
|
|
|
|
|
|
|
|
760
|
|
|
|
|
|
|
1; |
|
761
|
|
|
|
|
|
|
|
|
762
|
|
|
|
|
|
|
################################################################## |
|
763
|
|
|
|
|
|
|
package StorageDisplay::Role::Style::IsSubGraph; |
|
764
|
|
|
|
|
|
|
|
|
765
|
1
|
|
|
1
|
|
5169
|
use Moose::Role; |
|
|
1
|
|
|
|
|
3
|
|
|
|
1
|
|
|
|
|
4
|
|
|
766
|
|
|
|
|
|
|
|
|
767
|
|
|
|
|
|
|
sub dotSubGraph { |
|
768
|
0
|
|
|
0
|
0
|
|
my $self = shift; |
|
769
|
0
|
|
|
|
|
|
return $self->_dotDefaultSubGraph(@_); |
|
770
|
|
|
|
|
|
|
} |
|
771
|
|
|
|
|
|
|
|
|
772
|
|
|
|
|
|
|
sub _dotDefaultSubGraph { |
|
773
|
0
|
|
|
0
|
|
|
my $self = shift; |
|
774
|
0
|
|
|
|
|
|
my $t = shift; |
|
775
|
|
|
|
|
|
|
|
|
776
|
0
|
|
|
|
|
|
my @text; |
|
777
|
0
|
|
|
|
|
|
my $it = $self->iterator(recurse => 0); |
|
778
|
0
|
|
|
|
|
|
while (defined(my $e = $it->next)) { |
|
779
|
0
|
|
|
|
|
|
push @text, $e->dotNode($t, @_); |
|
780
|
|
|
|
|
|
|
} |
|
781
|
0
|
|
|
|
|
|
return @text; |
|
782
|
|
|
|
|
|
|
} |
|
783
|
|
|
|
|
|
|
|
|
784
|
|
|
|
|
|
|
around '_dotDefaultNode' => sub { |
|
785
|
|
|
|
|
|
|
my $orig = shift; |
|
786
|
|
|
|
|
|
|
my $self = shift; |
|
787
|
|
|
|
|
|
|
my $t = shift // "\t"; |
|
788
|
|
|
|
|
|
|
|
|
789
|
|
|
|
|
|
|
my @text = ( |
|
790
|
|
|
|
|
|
|
'subgraph "cluster_'.$self->rawlinkname.'" {', |
|
791
|
|
|
|
|
|
|
$self->dotIndent( |
|
792
|
|
|
|
|
|
|
$t, |
|
793
|
|
|
|
|
|
|
$self->dotStyle($t, @_), |
|
794
|
|
|
|
|
|
|
$self->dotSubGraph($t, @_), |
|
795
|
|
|
|
|
|
|
$self->_dotDefaultLabelLine($t, @_), |
|
796
|
|
|
|
|
|
|
$self->dotStyleNode(), |
|
797
|
|
|
|
|
|
|
), |
|
798
|
|
|
|
|
|
|
'}', |
|
799
|
|
|
|
|
|
|
); |
|
800
|
|
|
|
|
|
|
return @text; |
|
801
|
|
|
|
|
|
|
}; |
|
802
|
|
|
|
|
|
|
|
|
803
|
|
|
|
|
|
|
around '_dotDefaultStyleNode' => sub { |
|
804
|
|
|
|
|
|
|
my $orig = shift; |
|
805
|
|
|
|
|
|
|
my $self = shift; |
|
806
|
|
|
|
|
|
|
|
|
807
|
|
|
|
|
|
|
return (); |
|
808
|
|
|
|
|
|
|
}; |
|
809
|
|
|
|
|
|
|
|
|
810
|
|
|
|
|
|
|
with ( |
|
811
|
|
|
|
|
|
|
'StorageDisplay::Role::Style::Base', |
|
812
|
|
|
|
|
|
|
); |
|
813
|
|
|
|
|
|
|
|
|
814
|
|
|
|
|
|
|
1; |
|
815
|
|
|
|
|
|
|
|
|
816
|
|
|
|
|
|
|
################################################################## |
|
817
|
|
|
|
|
|
|
package StorageDisplay::Role::Style::Label::HTML; |
|
818
|
|
|
|
|
|
|
|
|
819
|
1
|
|
|
1
|
|
5354
|
use Moose::Role; |
|
|
1
|
|
|
|
|
21
|
|
|
|
1
|
|
|
|
|
8
|
|
|
820
|
|
|
|
|
|
|
|
|
821
|
|
|
|
|
|
|
with ( |
|
822
|
|
|
|
|
|
|
'StorageDisplay::Role::Style::Base::HTML', |
|
823
|
|
|
|
|
|
|
'StorageDisplay::Role::Style::Base', |
|
824
|
|
|
|
|
|
|
); |
|
825
|
|
|
|
|
|
|
|
|
826
|
|
|
|
|
|
|
1; |
|
827
|
|
|
|
|
|
|
|
|
828
|
|
|
|
|
|
|
################################################################## |
|
829
|
|
|
|
|
|
|
package StorageDisplay::Role::Style::Label::HTML::Table; |
|
830
|
|
|
|
|
|
|
|
|
831
|
1
|
|
|
1
|
|
5070
|
use Moose::Role; |
|
|
1
|
|
|
|
|
2
|
|
|
|
1
|
|
|
|
|
4
|
|
|
832
|
|
|
|
|
|
|
|
|
833
|
|
|
|
|
|
|
sub dotStyleTable { |
|
834
|
0
|
|
|
0
|
0
|
|
return ''; |
|
835
|
|
|
|
|
|
|
}; |
|
836
|
|
|
|
|
|
|
|
|
837
|
|
|
|
|
|
|
around '_dotTableLabel' => sub { |
|
838
|
|
|
|
|
|
|
my $orig = shift; |
|
839
|
|
|
|
|
|
|
my $self = shift; |
|
840
|
|
|
|
|
|
|
my $t = shift; |
|
841
|
|
|
|
|
|
|
my $it = $self->iterator(recurse => 0); |
|
842
|
|
|
|
|
|
|
|
|
843
|
|
|
|
|
|
|
return ('<TABLE '.$self->dotStyleTable(@_).'>', |
|
844
|
|
|
|
|
|
|
$self->dotIndent( |
|
845
|
|
|
|
|
|
|
$t, |
|
846
|
|
|
|
|
|
|
$self->dotTable($t, $it, @_), |
|
847
|
|
|
|
|
|
|
), |
|
848
|
|
|
|
|
|
|
'</TABLE>', |
|
849
|
|
|
|
|
|
|
); |
|
850
|
|
|
|
|
|
|
}; |
|
851
|
|
|
|
|
|
|
|
|
852
|
|
|
|
|
|
|
sub dotTable { |
|
853
|
0
|
|
|
0
|
0
|
|
my $self=shift; |
|
854
|
|
|
|
|
|
|
|
|
855
|
0
|
|
|
|
|
|
return $self->_dotDefaultTable(@_); |
|
856
|
|
|
|
|
|
|
} |
|
857
|
|
|
|
|
|
|
|
|
858
|
|
|
|
|
|
|
sub _dotDefaultTable { |
|
859
|
0
|
|
|
0
|
|
|
my $self=shift; |
|
860
|
0
|
|
|
|
|
|
my $t = shift; |
|
861
|
0
|
|
|
|
|
|
my $it = shift; |
|
862
|
|
|
|
|
|
|
|
|
863
|
0
|
|
|
|
|
|
my @text; |
|
864
|
0
|
|
|
|
|
|
while (defined(my $e = $it->next)) { |
|
865
|
0
|
|
|
|
|
|
push @text, '<TR><TD>', |
|
866
|
|
|
|
|
|
|
$self->dotIndent($t, $e->dotNode($t, @_)), |
|
867
|
|
|
|
|
|
|
'</TD></TR>' |
|
868
|
|
|
|
|
|
|
} |
|
869
|
|
|
|
|
|
|
|
|
870
|
0
|
|
|
|
|
|
return @text; |
|
871
|
|
|
|
|
|
|
} |
|
872
|
|
|
|
|
|
|
|
|
873
|
|
|
|
|
|
|
with ( |
|
874
|
|
|
|
|
|
|
'StorageDisplay::Role::Style::Base::HTML', |
|
875
|
|
|
|
|
|
|
'StorageDisplay::Role::Style::Base', |
|
876
|
|
|
|
|
|
|
); |
|
877
|
|
|
|
|
|
|
|
|
878
|
|
|
|
|
|
|
1; |
|
879
|
|
|
|
|
|
|
|
|
880
|
|
|
|
|
|
|
################################################################## |
|
881
|
|
|
|
|
|
|
package StorageDisplay::Role::Style::Plain; |
|
882
|
|
|
|
|
|
|
|
|
883
|
1
|
|
|
1
|
|
5338
|
use Moose::Role; |
|
|
1
|
|
|
|
|
2
|
|
|
|
1
|
|
|
|
|
5
|
|
|
884
|
|
|
|
|
|
|
|
|
885
|
|
|
|
|
|
|
sub dotStyle { |
|
886
|
0
|
|
|
0
|
0
|
|
my $orig = shift; |
|
887
|
0
|
|
|
|
|
|
my $self = shift; |
|
888
|
|
|
|
|
|
|
|
|
889
|
0
|
|
|
|
|
|
return ( ); |
|
890
|
|
|
|
|
|
|
}; |
|
891
|
|
|
|
|
|
|
|
|
892
|
|
|
|
|
|
|
with ( |
|
893
|
|
|
|
|
|
|
'StorageDisplay::Role::Style::Base', |
|
894
|
|
|
|
|
|
|
); |
|
895
|
|
|
|
|
|
|
|
|
896
|
|
|
|
|
|
|
1; |
|
897
|
|
|
|
|
|
|
|
|
898
|
|
|
|
|
|
|
################################################################## |
|
899
|
|
|
|
|
|
|
package StorageDisplay::Role::Style::WithSize; |
|
900
|
|
|
|
|
|
|
|
|
901
|
1
|
|
|
1
|
|
5471
|
use Moose::Role; |
|
|
1
|
|
|
|
|
2
|
|
|
|
1
|
|
|
|
|
4
|
|
|
902
|
|
|
|
|
|
|
|
|
903
|
|
|
|
|
|
|
has 'size' => ( |
|
904
|
|
|
|
|
|
|
is => 'ro', |
|
905
|
|
|
|
|
|
|
isa => 'Int', |
|
906
|
|
|
|
|
|
|
required => 1, |
|
907
|
|
|
|
|
|
|
); |
|
908
|
|
|
|
|
|
|
|
|
909
|
|
|
|
|
|
|
sub dotStyle { |
|
910
|
0
|
|
|
0
|
0
|
|
my $orig = shift; |
|
911
|
0
|
|
|
|
|
|
my $self = shift; |
|
912
|
|
|
|
|
|
|
|
|
913
|
|
|
|
|
|
|
return ( |
|
914
|
0
|
|
|
|
|
|
"style=filled;", |
|
915
|
|
|
|
|
|
|
"color=lightgrey;", |
|
916
|
|
|
|
|
|
|
"fillcolor=lightgrey;", |
|
917
|
|
|
|
|
|
|
"node [style=filled,color=lightgrey,fillcolor=lightgrey,shape=rectangle];", |
|
918
|
|
|
|
|
|
|
); |
|
919
|
|
|
|
|
|
|
}; |
|
920
|
|
|
|
|
|
|
|
|
921
|
|
|
|
|
|
|
sub sizeLabel { |
|
922
|
0
|
|
|
0
|
0
|
|
my $self = shift; |
|
923
|
0
|
|
|
|
|
|
return ("Size: ".$self->disp_size($self->size)); |
|
924
|
|
|
|
|
|
|
} |
|
925
|
|
|
|
|
|
|
|
|
926
|
|
|
|
|
|
|
around '_dotDefaultFullLabel' => sub { |
|
927
|
|
|
|
|
|
|
my $orig = shift; |
|
928
|
|
|
|
|
|
|
my $self = shift; |
|
929
|
|
|
|
|
|
|
|
|
930
|
|
|
|
|
|
|
return ( |
|
931
|
|
|
|
|
|
|
$self->$orig(@_), |
|
932
|
|
|
|
|
|
|
$self->sizeLabel(), |
|
933
|
|
|
|
|
|
|
); |
|
934
|
|
|
|
|
|
|
}; |
|
935
|
|
|
|
|
|
|
|
|
936
|
|
|
|
|
|
|
with ( |
|
937
|
|
|
|
|
|
|
'StorageDisplay::Role::Style::Base', |
|
938
|
|
|
|
|
|
|
); |
|
939
|
|
|
|
|
|
|
|
|
940
|
|
|
|
|
|
|
1; |
|
941
|
|
|
|
|
|
|
|
|
942
|
|
|
|
|
|
|
################################################################## |
|
943
|
|
|
|
|
|
|
package StorageDisplay::Role::Style::WithFree; |
|
944
|
|
|
|
|
|
|
|
|
945
|
1
|
|
|
1
|
|
5209
|
use Moose::Role; |
|
|
1
|
|
|
|
|
2
|
|
|
|
1
|
|
|
|
|
5
|
|
|
946
|
|
|
|
|
|
|
|
|
947
|
|
|
|
|
|
|
with 'StorageDisplay::Role::Style::WithSize'; |
|
948
|
|
|
|
|
|
|
|
|
949
|
|
|
|
|
|
|
has 'free' => ( |
|
950
|
|
|
|
|
|
|
is => 'ro', |
|
951
|
|
|
|
|
|
|
isa => 'Int', |
|
952
|
|
|
|
|
|
|
required => 1, |
|
953
|
|
|
|
|
|
|
); |
|
954
|
|
|
|
|
|
|
|
|
955
|
|
|
|
|
|
|
sub fillcolor { |
|
956
|
0
|
|
|
0
|
0
|
|
my $self = shift; |
|
957
|
|
|
|
|
|
|
|
|
958
|
0
|
|
|
|
|
|
my $fillcolor='"green"'; |
|
959
|
0
|
0
|
|
|
|
|
if ($self->size != $self->free) { |
|
960
|
0
|
|
|
|
|
|
$fillcolor= |
|
961
|
|
|
|
|
|
|
'"pink;'. |
|
962
|
|
|
|
|
|
|
sprintf("%f.2", ($self->size - $self->free) / $self->size). |
|
963
|
|
|
|
|
|
|
':green"'; |
|
964
|
|
|
|
|
|
|
} |
|
965
|
0
|
|
|
|
|
|
return $fillcolor; |
|
966
|
|
|
|
|
|
|
} |
|
967
|
|
|
|
|
|
|
|
|
968
|
|
|
|
|
|
|
around _dotDefaultStyleNode => sub { |
|
969
|
|
|
|
|
|
|
my $orig = shift; |
|
970
|
|
|
|
|
|
|
my $self = shift; |
|
971
|
|
|
|
|
|
|
|
|
972
|
|
|
|
|
|
|
return $self->dotJoinStyle( |
|
973
|
|
|
|
|
|
|
$self->$orig(@_), |
|
974
|
|
|
|
|
|
|
'shape=rectangle', |
|
975
|
|
|
|
|
|
|
'style=striped', |
|
976
|
|
|
|
|
|
|
'fillcolor='.$self->fillcolor, |
|
977
|
|
|
|
|
|
|
); |
|
978
|
|
|
|
|
|
|
}; |
|
979
|
|
|
|
|
|
|
|
|
980
|
|
|
|
|
|
|
around '_dotDefaultFullLabel' => sub { |
|
981
|
|
|
|
|
|
|
my $orig = shift; |
|
982
|
|
|
|
|
|
|
my $self = shift; |
|
983
|
|
|
|
|
|
|
|
|
984
|
|
|
|
|
|
|
my @labels = $self->$orig(@_); |
|
985
|
|
|
|
|
|
|
if ($self->size !=0 || $self->free != 0) { |
|
986
|
|
|
|
|
|
|
push @labels, "Free: ".$self->disp_size($self->free); |
|
987
|
|
|
|
|
|
|
} |
|
988
|
|
|
|
|
|
|
return @labels; |
|
989
|
|
|
|
|
|
|
}; |
|
990
|
|
|
|
|
|
|
|
|
991
|
|
|
|
|
|
|
1; |
|
992
|
|
|
|
|
|
|
|
|
993
|
|
|
|
|
|
|
################################################################## |
|
994
|
|
|
|
|
|
|
package StorageDisplay::Role::Style::WithUsed; |
|
995
|
|
|
|
|
|
|
|
|
996
|
1
|
|
|
1
|
|
5457
|
use Moose::Role; |
|
|
1
|
|
|
|
|
2
|
|
|
|
1
|
|
|
|
|
5
|
|
|
997
|
|
|
|
|
|
|
|
|
998
|
|
|
|
|
|
|
with 'StorageDisplay::Role::Style::WithFree'; |
|
999
|
|
|
|
|
|
|
|
|
1000
|
|
|
|
|
|
|
has 'used' => ( |
|
1001
|
|
|
|
|
|
|
is => 'ro', |
|
1002
|
|
|
|
|
|
|
isa => 'Int', |
|
1003
|
|
|
|
|
|
|
required => 1, |
|
1004
|
|
|
|
|
|
|
); |
|
1005
|
|
|
|
|
|
|
|
|
1006
|
|
|
|
|
|
|
has 'reserved' => ( |
|
1007
|
|
|
|
|
|
|
is => 'ro', |
|
1008
|
|
|
|
|
|
|
isa => 'Int', |
|
1009
|
|
|
|
|
|
|
required => 1, |
|
1010
|
|
|
|
|
|
|
lazy => 1, |
|
1011
|
|
|
|
|
|
|
default => sub { |
|
1012
|
|
|
|
|
|
|
my $self = shift; |
|
1013
|
|
|
|
|
|
|
my $reserved = $self->size - $self->used - $self->free; |
|
1014
|
|
|
|
|
|
|
if ($reserved < 0) { |
|
1015
|
|
|
|
|
|
|
print STDERR "Reserved: $reserved\n"; |
|
1016
|
|
|
|
|
|
|
$reserved = 0; |
|
1017
|
|
|
|
|
|
|
} |
|
1018
|
|
|
|
|
|
|
return $reserved; |
|
1019
|
|
|
|
|
|
|
}, |
|
1020
|
|
|
|
|
|
|
); |
|
1021
|
|
|
|
|
|
|
|
|
1022
|
|
|
|
|
|
|
around _dotDefaultStyleNode => sub { |
|
1023
|
|
|
|
|
|
|
my $orig = shift; |
|
1024
|
|
|
|
|
|
|
my $self = shift; |
|
1025
|
|
|
|
|
|
|
my $fillcolor; |
|
1026
|
|
|
|
|
|
|
my $part='@@@@@@@'; |
|
1027
|
|
|
|
|
|
|
|
|
1028
|
|
|
|
|
|
|
if ($self->used > 0) { |
|
1029
|
|
|
|
|
|
|
if (defined($fillcolor)) { |
|
1030
|
|
|
|
|
|
|
$fillcolor .= $part; |
|
1031
|
|
|
|
|
|
|
} |
|
1032
|
|
|
|
|
|
|
$fillcolor.='pink'; |
|
1033
|
|
|
|
|
|
|
$part=';'.sprintf("%f.2", $self->used / $self->size).':'; |
|
1034
|
|
|
|
|
|
|
} |
|
1035
|
|
|
|
|
|
|
if ($self->free > 0) { |
|
1036
|
|
|
|
|
|
|
if (defined($fillcolor)) { |
|
1037
|
|
|
|
|
|
|
$fillcolor .= $part; |
|
1038
|
|
|
|
|
|
|
} |
|
1039
|
|
|
|
|
|
|
$fillcolor.='green'; |
|
1040
|
|
|
|
|
|
|
$part=';'.sprintf("%f.2", $self->free / $self->size).':'; |
|
1041
|
|
|
|
|
|
|
} |
|
1042
|
|
|
|
|
|
|
if ($self->reserved > 0) { |
|
1043
|
|
|
|
|
|
|
if (defined($fillcolor)) { |
|
1044
|
|
|
|
|
|
|
$fillcolor .= $part; |
|
1045
|
|
|
|
|
|
|
} |
|
1046
|
|
|
|
|
|
|
$fillcolor.='orange'; |
|
1047
|
|
|
|
|
|
|
$part=';'.sprintf("%f.2", $self->reserved / $self->size).':'; |
|
1048
|
|
|
|
|
|
|
} |
|
1049
|
|
|
|
|
|
|
if (not defined($fillcolor)) { |
|
1050
|
|
|
|
|
|
|
if ($self->size == 0) { |
|
1051
|
|
|
|
|
|
|
$fillcolor='yellow'; |
|
1052
|
|
|
|
|
|
|
} else { |
|
1053
|
|
|
|
|
|
|
$fillcolor='red'; |
|
1054
|
|
|
|
|
|
|
} |
|
1055
|
|
|
|
|
|
|
} |
|
1056
|
|
|
|
|
|
|
|
|
1057
|
|
|
|
|
|
|
return $self->dotJoinStyle( |
|
1058
|
|
|
|
|
|
|
$self->$orig(@_), |
|
1059
|
|
|
|
|
|
|
'shape=rectangle', |
|
1060
|
|
|
|
|
|
|
'style=striped', |
|
1061
|
|
|
|
|
|
|
'fillcolor="'.$fillcolor.'"', |
|
1062
|
|
|
|
|
|
|
); |
|
1063
|
|
|
|
|
|
|
}; |
|
1064
|
|
|
|
|
|
|
|
|
1065
|
|
|
|
|
|
|
sub dotStyle { |
|
1066
|
0
|
|
|
0
|
0
|
|
my $orig = shift; |
|
1067
|
0
|
|
|
|
|
|
my $self = shift; |
|
1068
|
|
|
|
|
|
|
|
|
1069
|
|
|
|
|
|
|
return ( |
|
1070
|
0
|
|
|
|
|
|
"style=filled;", |
|
1071
|
|
|
|
|
|
|
"color=lightgrey;", |
|
1072
|
|
|
|
|
|
|
"fillcolor=lightgrey;", |
|
1073
|
|
|
|
|
|
|
"node [style=filled,color=lightgrey,fillcolor=lightgrey,shape=rectangle];", |
|
1074
|
|
|
|
|
|
|
); |
|
1075
|
|
|
|
|
|
|
}; |
|
1076
|
|
|
|
|
|
|
|
|
1077
|
|
|
|
|
|
|
around '_dotDefaultFullLabel' => sub { |
|
1078
|
|
|
|
|
|
|
my $orig = shift; |
|
1079
|
|
|
|
|
|
|
my $self = shift; |
|
1080
|
|
|
|
|
|
|
|
|
1081
|
|
|
|
|
|
|
my @labels = $self->$orig(@_); |
|
1082
|
|
|
|
|
|
|
if ($self->size !=0 || $self->used != 0) { |
|
1083
|
|
|
|
|
|
|
push @labels, "Used: ".$self->disp_size($self->used); |
|
1084
|
|
|
|
|
|
|
} |
|
1085
|
|
|
|
|
|
|
return @labels; |
|
1086
|
|
|
|
|
|
|
}; |
|
1087
|
|
|
|
|
|
|
|
|
1088
|
|
|
|
|
|
|
1; |
|
1089
|
|
|
|
|
|
|
|
|
1090
|
|
|
|
|
|
|
################################################################## |
|
1091
|
|
|
|
|
|
|
package StorageDisplay::Role::Style::SubInternal; |
|
1092
|
|
|
|
|
|
|
|
|
1093
|
1
|
|
|
1
|
|
5584
|
use Moose::Role; |
|
|
1
|
|
|
|
|
2
|
|
|
|
1
|
|
|
|
|
4
|
|
|
1094
|
|
|
|
|
|
|
|
|
1095
|
|
|
|
|
|
|
sub dotStyle { |
|
1096
|
0
|
|
|
0
|
0
|
|
my $self = shift; |
|
1097
|
0
|
|
0
|
|
|
|
my $t = shift // "\t"; |
|
1098
|
|
|
|
|
|
|
|
|
1099
|
|
|
|
|
|
|
return ( |
|
1100
|
|
|
|
|
|
|
#"style=filled;", |
|
1101
|
0
|
|
|
|
|
|
"color=white;", |
|
1102
|
|
|
|
|
|
|
"fillcolor=white;", |
|
1103
|
|
|
|
|
|
|
#"node [style=filled,color=lightgrey,fillcolor=lightgrey,shape=rectangle];", |
|
1104
|
|
|
|
|
|
|
); |
|
1105
|
|
|
|
|
|
|
} |
|
1106
|
|
|
|
|
|
|
|
|
1107
|
|
|
|
|
|
|
with ( |
|
1108
|
|
|
|
|
|
|
'StorageDisplay::Role::Style::Base', |
|
1109
|
|
|
|
|
|
|
); |
|
1110
|
|
|
|
|
|
|
|
|
1111
|
|
|
|
|
|
|
1; |
|
1112
|
|
|
|
|
|
|
|
|
1113
|
|
|
|
|
|
|
################################################################## |
|
1114
|
|
|
|
|
|
|
package StorageDisplay::Role::Style::Grey; |
|
1115
|
|
|
|
|
|
|
|
|
1116
|
1
|
|
|
1
|
|
5339
|
use Moose::Role; |
|
|
1
|
|
|
|
|
2
|
|
|
|
1
|
|
|
|
|
5
|
|
|
1117
|
|
|
|
|
|
|
|
|
1118
|
|
|
|
|
|
|
sub dotStyle { |
|
1119
|
0
|
|
|
0
|
0
|
|
my $self = shift; |
|
1120
|
0
|
|
0
|
|
|
|
my $t = shift // "\t"; |
|
1121
|
|
|
|
|
|
|
|
|
1122
|
|
|
|
|
|
|
return ( |
|
1123
|
0
|
|
|
|
|
|
"style=filled;", |
|
1124
|
|
|
|
|
|
|
"color=lightgrey;", |
|
1125
|
|
|
|
|
|
|
"fillcolor=lightgrey;", |
|
1126
|
|
|
|
|
|
|
"node [style=filled,color=white,fillcolor=lightgrey,shape=rectangle];", |
|
1127
|
|
|
|
|
|
|
); |
|
1128
|
|
|
|
|
|
|
} |
|
1129
|
|
|
|
|
|
|
|
|
1130
|
|
|
|
|
|
|
with ( |
|
1131
|
|
|
|
|
|
|
'StorageDisplay::Role::Style::Base', |
|
1132
|
|
|
|
|
|
|
); |
|
1133
|
|
|
|
|
|
|
|
|
1134
|
|
|
|
|
|
|
1; |
|
1135
|
|
|
|
|
|
|
|
|
1136
|
|
|
|
|
|
|
################################################################## |
|
1137
|
|
|
|
|
|
|
package StorageDisplay::Role::Style::Machine; |
|
1138
|
|
|
|
|
|
|
|
|
1139
|
1
|
|
|
1
|
|
5306
|
use Moose::Role; |
|
|
1
|
|
|
|
|
3
|
|
|
|
1
|
|
|
|
|
6
|
|
|
1140
|
|
|
|
|
|
|
|
|
1141
|
|
|
|
|
|
|
sub dotStyle { |
|
1142
|
0
|
|
|
0
|
0
|
|
my $self = shift; |
|
1143
|
0
|
|
0
|
|
|
|
my $t = shift // "\t"; |
|
1144
|
|
|
|
|
|
|
|
|
1145
|
|
|
|
|
|
|
return ( |
|
1146
|
0
|
|
|
|
|
|
"style=filled;", |
|
1147
|
|
|
|
|
|
|
"color=lightgrey;", |
|
1148
|
|
|
|
|
|
|
"fillcolor=white;", |
|
1149
|
|
|
|
|
|
|
"node [style=filled,color=white,fillcolor=white,shape=rectangle];", |
|
1150
|
|
|
|
|
|
|
); |
|
1151
|
|
|
|
|
|
|
} |
|
1152
|
|
|
|
|
|
|
|
|
1153
|
|
|
|
|
|
|
with ( |
|
1154
|
|
|
|
|
|
|
'StorageDisplay::Role::Style::Base', |
|
1155
|
|
|
|
|
|
|
); |
|
1156
|
|
|
|
|
|
|
|
|
1157
|
|
|
|
|
|
|
1; |
|
1158
|
|
|
|
|
|
|
|
|
1159
|
|
|
|
|
|
|
################################################################## |
|
1160
|
|
|
|
|
|
|
package StorageDisplay::Role::Style::FromBlockState; |
|
1161
|
|
|
|
|
|
|
|
|
1162
|
1
|
|
|
1
|
|
5138
|
use Moose::Role; |
|
|
1
|
|
|
|
|
3
|
|
|
|
1
|
|
|
|
|
4
|
|
|
1163
|
|
|
|
|
|
|
|
|
1164
|
|
|
|
|
|
|
sub _dotDefaultStyleNodeState { |
|
1165
|
0
|
|
|
0
|
|
|
my $self = shift; |
|
1166
|
|
|
|
|
|
|
|
|
1167
|
0
|
|
|
|
|
|
my $state = "unknown"; |
|
1168
|
0
|
0
|
|
|
|
|
if (defined($self->block)) { |
|
1169
|
0
|
|
|
|
|
|
$state = $self->block->state; |
|
1170
|
|
|
|
|
|
|
} |
|
1171
|
|
|
|
|
|
|
|
|
1172
|
0
|
|
|
|
|
|
return 'fillcolor="'.$self->statecolor($state).'"'; |
|
1173
|
|
|
|
|
|
|
} |
|
1174
|
|
|
|
|
|
|
|
|
1175
|
|
|
|
|
|
|
1; |
|
1176
|
|
|
|
|
|
|
|
|
1177
|
|
|
|
|
|
|
__END__ |
|
1178
|
|
|
|
|
|
|
|
|
1179
|
|
|
|
|
|
|
=pod |
|
1180
|
|
|
|
|
|
|
|
|
1181
|
|
|
|
|
|
|
=encoding UTF-8 |
|
1182
|
|
|
|
|
|
|
|
|
1183
|
|
|
|
|
|
|
=head1 NAME |
|
1184
|
|
|
|
|
|
|
|
|
1185
|
|
|
|
|
|
|
StorageDisplay::Role - Load all roles used in StorageDisplay |
|
1186
|
|
|
|
|
|
|
|
|
1187
|
|
|
|
|
|
|
=head1 VERSION |
|
1188
|
|
|
|
|
|
|
|
|
1189
|
|
|
|
|
|
|
version 2.04 |
|
1190
|
|
|
|
|
|
|
|
|
1191
|
|
|
|
|
|
|
=head1 AUTHOR |
|
1192
|
|
|
|
|
|
|
|
|
1193
|
|
|
|
|
|
|
Vincent Danjean <Vincent.Danjean@ens-lyon.org> |
|
1194
|
|
|
|
|
|
|
|
|
1195
|
|
|
|
|
|
|
=head1 COPYRIGHT AND LICENSE |
|
1196
|
|
|
|
|
|
|
|
|
1197
|
|
|
|
|
|
|
This software is copyright (c) 2014-2023 by Vincent Danjean. |
|
1198
|
|
|
|
|
|
|
|
|
1199
|
|
|
|
|
|
|
This is free software; you can redistribute it and/or modify it under |
|
1200
|
|
|
|
|
|
|
the same terms as the Perl 5 programming language system itself. |
|
1201
|
|
|
|
|
|
|
|
|
1202
|
|
|
|
|
|
|
=cut |