line |
stmt |
bran |
cond |
sub |
pod |
time |
code |
1
|
|
|
|
|
|
|
package File::Descriptions; |
2
|
|
|
|
|
|
|
|
3
|
1
|
|
|
1
|
|
945
|
use strict; |
|
1
|
|
|
|
|
1
|
|
|
1
|
|
|
|
|
44
|
|
4
|
1
|
|
|
1
|
|
5
|
use vars qw($VERSION @ISA @EXPORT @EXPORT_OK); |
|
1
|
|
|
|
|
2
|
|
|
1
|
|
|
|
|
2296
|
|
5
|
|
|
|
|
|
|
|
6
|
|
|
|
|
|
|
#========================================================================= |
7
|
|
|
|
|
|
|
# Require |
8
|
|
|
|
|
|
|
#------------------------------------------------------------------------- |
9
|
|
|
|
|
|
|
# Modules also used |
10
|
|
|
|
|
|
|
# require Tie::CPHash; |
11
|
|
|
|
|
|
|
|
12
|
|
|
|
|
|
|
require Exporter; |
13
|
|
|
|
|
|
|
require AutoLoader; |
14
|
|
|
|
|
|
|
|
15
|
|
|
|
|
|
|
@ISA = qw(Exporter AutoLoader); |
16
|
|
|
|
|
|
|
# Items to export into callers namespace by default. Note: do not export |
17
|
|
|
|
|
|
|
# names by default without a very good reason. Use EXPORT_OK instead. |
18
|
|
|
|
|
|
|
# Do not simply export all your public functions/methods/constants. |
19
|
|
|
|
|
|
|
@EXPORT = qw( |
20
|
|
|
|
|
|
|
|
21
|
|
|
|
|
|
|
); |
22
|
|
|
|
|
|
|
$VERSION = '0.03'; |
23
|
|
|
|
|
|
|
|
24
|
|
|
|
|
|
|
|
25
|
|
|
|
|
|
|
# Preloaded methods go here. |
26
|
|
|
|
|
|
|
|
27
|
|
|
|
|
|
|
#========================================================================= |
28
|
|
|
|
|
|
|
# Methods |
29
|
|
|
|
|
|
|
#------------------------------------------------------------------------- |
30
|
|
|
|
|
|
|
# Constructor |
31
|
|
|
|
|
|
|
|
32
|
|
|
|
|
|
|
sub new |
33
|
|
|
|
|
|
|
{ |
34
|
1
|
|
|
1
|
0
|
40
|
my $class = shift; |
35
|
1
|
|
|
|
|
2
|
my $self = {}; |
36
|
1
|
|
50
|
|
|
6
|
$self->{dir} = $_[0] || '.'; |
37
|
1
|
|
|
|
|
2
|
%{$self->{desc}} = (); |
|
1
|
|
|
|
|
4
|
|
38
|
|
|
|
|
|
|
# tie %{$self->{desc}},'Tie::CPHash'; |
39
|
1
|
|
|
|
|
3
|
bless $self, $class; |
40
|
1
|
|
|
|
|
4
|
$self; |
41
|
|
|
|
|
|
|
} |
42
|
|
|
|
|
|
|
|
43
|
|
|
|
|
|
|
#========================================================================= |
44
|
|
|
|
|
|
|
# Methods |
45
|
|
|
|
|
|
|
#------------------------------------------------------------------------- |
46
|
|
|
|
|
|
|
# Destructor |
47
|
|
|
|
|
|
|
|
48
|
|
|
|
|
|
|
sub DESTROY |
49
|
|
|
|
|
|
|
{ |
50
|
1
|
|
|
1
|
|
172
|
my $self = shift; |
51
|
|
|
|
|
|
|
# untie %{$self->{desc}}; |
52
|
|
|
|
|
|
|
} |
53
|
|
|
|
|
|
|
|
54
|
|
|
|
|
|
|
#========================================================================= |
55
|
|
|
|
|
|
|
# Methods |
56
|
|
|
|
|
|
|
#------------------------------------------------------------------------- |
57
|
|
|
|
|
|
|
# gethash($directory) |
58
|
|
|
|
|
|
|
|
59
|
|
|
|
|
|
|
sub gethash |
60
|
|
|
|
|
|
|
{ |
61
|
4
|
|
|
4
|
0
|
152
|
my $self = shift; |
62
|
4
|
50
|
|
|
|
13
|
$self->{dir} = $_[0] if $_[0]; |
63
|
|
|
|
|
|
|
|
64
|
|
|
|
|
|
|
# Make something to cache dir's ... |
65
|
4
|
|
|
|
|
4
|
%{$self->{desc}->{ $self->{dir} }} = (); |
|
4
|
|
|
|
|
14
|
|
66
|
|
|
|
|
|
|
|
67
|
|
|
|
|
|
|
# get file descriptions on $self->dir |
68
|
4
|
|
|
|
|
10
|
$self->{desc}->{ $self->{dir} }->{'test'} = 'okay'; |
69
|
|
|
|
|
|
|
|
70
|
4
|
|
|
|
|
11
|
$self->try_simtelnet(); |
71
|
4
|
|
|
|
|
11
|
$self->try_debian(); |
72
|
4
|
|
|
|
|
8
|
$self->try_freebsd(); |
73
|
|
|
|
|
|
|
|
74
|
|
|
|
|
|
|
# return the array... |
75
|
4
|
|
|
|
|
6
|
return %{$self->{desc}->{ $self->{dir} }}; |
|
4
|
|
|
|
|
178
|
|
76
|
|
|
|
|
|
|
} |
77
|
|
|
|
|
|
|
|
78
|
|
|
|
|
|
|
sub directory |
79
|
|
|
|
|
|
|
{ |
80
|
14
|
|
|
14
|
0
|
21
|
my $self = shift; |
81
|
|
|
|
|
|
|
|
82
|
14
|
|
|
|
|
35
|
return $self->{dir}; |
83
|
|
|
|
|
|
|
|
84
|
|
|
|
|
|
|
} |
85
|
|
|
|
|
|
|
|
86
|
|
|
|
|
|
|
sub try_simtelnet |
87
|
|
|
|
|
|
|
{ |
88
|
4
|
|
|
4
|
0
|
7
|
my $self = shift; |
89
|
4
|
|
|
|
|
7
|
my $current_dir = $self->directory; |
90
|
|
|
|
|
|
|
|
91
|
4
|
100
|
|
|
|
14
|
$current_dir.='/' unless ($current_dir =~ /\/$/); |
92
|
|
|
|
|
|
|
|
93
|
4
|
|
|
|
|
7
|
my $current_file=$current_dir.'dirs.txt'; |
94
|
|
|
|
|
|
|
|
95
|
4
|
100
|
|
|
|
51
|
if ( -f $current_file ) { |
96
|
1
|
50
|
|
|
|
7
|
if ( -r _ ) { |
97
|
1
|
50
|
|
|
|
31
|
if (open(DESCRIPTOR,"<".$current_file)) { |
98
|
|
|
|
|
|
|
# ok, we got the dirs, checking: |
99
|
1
|
|
|
|
|
26
|
my $line = ; |
100
|
1
|
50
|
|
|
|
5
|
if ($line =~ /simtel/i) { |
101
|
|
|
|
|
|
|
# checked it's a simtel file... |
102
|
1
|
|
|
|
|
10
|
my $got_the_blank = 0; |
103
|
1
|
|
|
|
|
5
|
while () { |
104
|
178
|
|
|
|
|
163
|
chomp; |
105
|
|
|
|
|
|
|
# chomping a probable \r also... |
106
|
178
|
|
|
|
|
155
|
chomp; |
107
|
178
|
100
|
|
|
|
267
|
$got_the_blank++ if ($_ eq ''); |
108
|
178
|
100
|
|
|
|
239
|
last if ($got_the_blank > 1); |
109
|
177
|
100
|
|
|
|
263
|
if ($got_the_blank) { |
110
|
|
|
|
|
|
|
# start picking up the passangers |
111
|
176
|
|
|
|
|
133
|
my $file; |
112
|
|
|
|
|
|
|
my $desc; |
113
|
176
|
|
|
|
|
653
|
($file,$desc) = ($_ =~ /^(\S+)\s+(.+)$/); |
114
|
176
|
|
|
|
|
831
|
$self->{desc}->{ $self->{dir} }->{$file} = $desc; |
115
|
|
|
|
|
|
|
} |
116
|
|
|
|
|
|
|
} |
117
|
|
|
|
|
|
|
} |
118
|
1
|
|
|
|
|
18
|
close(DESCRIPTOR); |
119
|
|
|
|
|
|
|
} |
120
|
|
|
|
|
|
|
} |
121
|
|
|
|
|
|
|
} |
122
|
|
|
|
|
|
|
|
123
|
4
|
|
|
|
|
9
|
my $current_file=$current_dir.'00_index.txt'; |
124
|
|
|
|
|
|
|
|
125
|
|
|
|
|
|
|
|
126
|
4
|
100
|
|
|
|
46
|
if ( -f $current_file ) { |
127
|
1
|
50
|
|
|
|
6
|
if ( -r _ ) { |
128
|
1
|
50
|
|
|
|
37
|
if (open(DESCRIPTOR,"<".$current_file)) { |
129
|
|
|
|
|
|
|
# ok, we got the dirs, checking: |
130
|
1
|
|
|
|
|
20
|
my $line = ; |
131
|
1
|
50
|
|
|
|
5
|
if ($line =~ /^NOTE/i) { |
132
|
|
|
|
|
|
|
# checked it's a simtel file... |
133
|
1
|
|
|
|
|
2
|
my $got_the_blank = 0; |
134
|
1
|
|
|
|
|
4
|
while () { |
135
|
20
|
|
|
|
|
23
|
chomp; |
136
|
|
|
|
|
|
|
# chomping a probable \r also... |
137
|
20
|
|
|
|
|
29
|
chomp; |
138
|
20
|
100
|
|
|
|
37
|
$got_the_blank++ if ($_ eq ''); |
139
|
20
|
50
|
|
|
|
27
|
last if ($got_the_blank > 2); |
140
|
20
|
100
|
|
|
|
42
|
if ($got_the_blank == 2) { |
141
|
|
|
|
|
|
|
# skip rubble |
142
|
16
|
|
|
|
|
22
|
; |
143
|
16
|
|
|
|
|
25
|
; |
144
|
16
|
|
|
|
|
24
|
; |
145
|
|
|
|
|
|
|
# start picking up the passangers |
146
|
16
|
|
|
|
|
21
|
my $file; |
147
|
|
|
|
|
|
|
my $desc; |
148
|
16
|
|
|
|
|
68
|
($file,$desc) = ($_ =~ /^(\S+)\s+\S+\s+\S+\s+\S+\s+(.+)$/); |
149
|
16
|
|
|
|
|
106
|
$self->{desc}->{ $self->{dir} }->{$file} = $desc; |
150
|
|
|
|
|
|
|
} |
151
|
|
|
|
|
|
|
} |
152
|
|
|
|
|
|
|
} |
153
|
1
|
|
|
|
|
10
|
close(DESCRIPTOR); |
154
|
|
|
|
|
|
|
} |
155
|
|
|
|
|
|
|
} |
156
|
|
|
|
|
|
|
} |
157
|
|
|
|
|
|
|
} |
158
|
|
|
|
|
|
|
|
159
|
|
|
|
|
|
|
sub try_debian |
160
|
|
|
|
|
|
|
{ |
161
|
4
|
|
|
4
|
0
|
6
|
my $self = shift; |
162
|
4
|
|
|
|
|
7
|
my $current_dir = $self->directory; |
163
|
|
|
|
|
|
|
|
164
|
4
|
100
|
|
|
|
14
|
$current_dir.='/' unless ($current_dir =~ /\/$/); |
165
|
|
|
|
|
|
|
|
166
|
4
|
|
|
|
|
8
|
my $current_file=$current_dir.'../'.'Packages'; |
167
|
|
|
|
|
|
|
|
168
|
4
|
100
|
|
|
|
46
|
if ( -f $current_file ) { |
169
|
1
|
50
|
|
|
|
9
|
if ( -r _ ) { |
170
|
1
|
50
|
|
|
|
36
|
if (open(DESCRIPTOR,"<".$current_file)) { |
171
|
|
|
|
|
|
|
# ok, we got the dirs |
172
|
1
|
|
|
|
|
2
|
my $got_the_file = 0; |
173
|
1
|
|
|
|
|
1
|
my $file; |
174
|
|
|
|
|
|
|
my $desc; |
175
|
1
|
|
|
|
|
22
|
while () { |
176
|
33
|
|
|
|
|
31
|
chomp; |
177
|
|
|
|
|
|
|
# chomping a probable \r also... |
178
|
33
|
|
|
|
|
32
|
chomp; |
179
|
|
|
|
|
|
|
# start picking up the passangers |
180
|
33
|
100
|
|
|
|
71
|
if ($_ =~ /^Filename:/i) { |
181
|
2
|
|
|
|
|
18
|
($file) = ($_ =~ /\/([^\/]*?)$/); |
182
|
2
|
50
|
|
|
|
8
|
if ($file ne '') { |
183
|
2
|
|
|
|
|
4
|
my $current_test = $current_dir.$file; |
184
|
2
|
100
|
|
|
|
31
|
if ( -e $current_test ) { |
185
|
1
|
|
|
|
|
3
|
$got_the_file++; |
186
|
|
|
|
|
|
|
} |
187
|
|
|
|
|
|
|
} |
188
|
|
|
|
|
|
|
} |
189
|
33
|
100
|
|
|
|
69
|
if ($_ =~ /Description:/i) { |
190
|
2
|
|
|
|
|
9
|
($desc) = ($_ =~ /^\S+:\s+(.+)$/); |
191
|
2
|
|
|
|
|
3
|
$got_the_file++; |
192
|
|
|
|
|
|
|
} |
193
|
33
|
100
|
|
|
|
64
|
if ($got_the_file == 2) { |
194
|
5
|
|
|
|
|
9
|
$self->{desc}->{ $self->{dir} }->{$file} = $desc; |
195
|
|
|
|
|
|
|
} |
196
|
33
|
100
|
|
|
|
99
|
if ($_ eq '') { |
197
|
1
|
|
|
|
|
3
|
$got_the_file = 0; |
198
|
|
|
|
|
|
|
} |
199
|
|
|
|
|
|
|
} |
200
|
1
|
|
|
|
|
9
|
close(DESCRIPTOR); |
201
|
|
|
|
|
|
|
} |
202
|
|
|
|
|
|
|
} |
203
|
|
|
|
|
|
|
} |
204
|
|
|
|
|
|
|
} |
205
|
|
|
|
|
|
|
|
206
|
|
|
|
|
|
|
sub try_freebsd |
207
|
|
|
|
|
|
|
{ |
208
|
4
|
|
|
4
|
0
|
5
|
my $self = shift; |
209
|
4
|
|
|
|
|
7
|
my $current_dir = $self->directory; |
210
|
|
|
|
|
|
|
|
211
|
4
|
100
|
|
|
|
15
|
$current_dir.='/' unless ($current_dir =~ /\/$/); |
212
|
|
|
|
|
|
|
|
213
|
4
|
|
|
|
|
7
|
my $current_file=$current_dir.'../'.'INDEX'; |
214
|
|
|
|
|
|
|
|
215
|
4
|
100
|
|
|
|
41
|
if ( -f $current_file ) { |
216
|
1
|
50
|
|
|
|
5
|
if ( -r _ ) { |
217
|
1
|
50
|
|
|
|
27
|
if (open(DESCRIPTOR,"<".$current_file)) { |
218
|
|
|
|
|
|
|
# ok, we got the dirs |
219
|
1
|
|
|
|
|
2
|
my $got_the_file = 0; |
220
|
1
|
|
|
|
|
1
|
my @desc; |
221
|
1
|
|
|
|
|
11
|
while () { |
222
|
2
|
|
|
|
|
473
|
chomp; |
223
|
|
|
|
|
|
|
# chomping a probable \r also... |
224
|
2
|
|
|
|
|
3
|
chomp; |
225
|
|
|
|
|
|
|
# start picking up the passangers |
226
|
2
|
|
|
|
|
12
|
@desc = split (/\|/,$_); |
227
|
2
|
50
|
|
|
|
10
|
if ($#desc = 6) { |
228
|
2
|
|
|
|
|
5
|
my $current_test = $current_dir.$desc[0].'.tgz'; |
229
|
2
|
100
|
|
|
|
29
|
if ( -e $current_test ) { |
230
|
1
|
|
|
|
|
7
|
$self->{desc}->{ $self->{dir} }->{$desc[0].'.tgz'} = $desc[3]; |
231
|
|
|
|
|
|
|
} |
232
|
|
|
|
|
|
|
} |
233
|
|
|
|
|
|
|
} |
234
|
1
|
|
|
|
|
10
|
close(DESCRIPTOR); |
235
|
|
|
|
|
|
|
} |
236
|
|
|
|
|
|
|
} |
237
|
|
|
|
|
|
|
} |
238
|
|
|
|
|
|
|
} |
239
|
|
|
|
|
|
|
|
240
|
|
|
|
|
|
|
# Autoload methods go after =cut, and are processed by the autosplit program. |
241
|
|
|
|
|
|
|
|
242
|
|
|
|
|
|
|
1; |
243
|
|
|
|
|
|
|
__END__ |