line |
stmt |
bran |
cond |
sub |
pod |
time |
code |
1
|
|
|
|
|
|
|
package WWW::IndexParser::Entry; |
2
|
1
|
|
|
1
|
|
5
|
use strict; |
|
1
|
|
|
|
|
2
|
|
|
1
|
|
|
|
|
38
|
|
3
|
1
|
|
|
1
|
|
6
|
use warnings; |
|
1
|
|
|
|
|
3
|
|
|
1
|
|
|
|
|
44
|
|
4
|
1
|
|
|
1
|
|
6
|
use overload '""' => \&_as_string; |
|
1
|
|
|
|
|
1
|
|
|
1
|
|
|
|
|
11
|
|
5
|
|
|
|
|
|
|
|
6
|
|
|
|
|
|
|
BEGIN { |
7
|
1
|
|
|
1
|
|
1753
|
our $VERSION = "0.6"; |
8
|
|
|
|
|
|
|
} |
9
|
|
|
|
|
|
|
|
10
|
|
|
|
|
|
|
|
11
|
|
|
|
|
|
|
sub new { |
12
|
0
|
|
|
0
|
0
|
|
my $proto = shift; |
13
|
0
|
|
0
|
|
|
|
my $class = ref($proto) || $proto; |
14
|
0
|
|
|
|
|
|
my $self = {}; |
15
|
0
|
|
|
|
|
|
bless $self, $class; |
16
|
0
|
|
|
|
|
|
return $self; |
17
|
|
|
|
|
|
|
} |
18
|
|
|
|
|
|
|
|
19
|
|
|
|
|
|
|
sub filename { |
20
|
0
|
|
|
0
|
1
|
|
my $self = shift; |
21
|
0
|
0
|
|
|
|
|
if (@_) { |
22
|
0
|
|
|
|
|
|
$self->{filename} = shift; |
23
|
|
|
|
|
|
|
} |
24
|
0
|
|
|
|
|
|
return $self->{filename}; |
25
|
|
|
|
|
|
|
} |
26
|
|
|
|
|
|
|
|
27
|
|
|
|
|
|
|
sub url { |
28
|
0
|
|
|
0
|
1
|
|
my $self = shift; |
29
|
0
|
0
|
|
|
|
|
if (@_) { |
30
|
0
|
|
|
|
|
|
my $new_url = shift; |
31
|
0
|
0
|
|
|
|
|
return unless $new_url =~ m!^\w+://[^:\s/]+(:\d+)?/!; |
32
|
0
|
|
|
|
|
|
$self->{url} = $new_url; |
33
|
|
|
|
|
|
|
} |
34
|
0
|
|
|
|
|
|
return $self->{url}; |
35
|
|
|
|
|
|
|
} |
36
|
|
|
|
|
|
|
|
37
|
|
|
|
|
|
|
sub time { |
38
|
0
|
|
|
0
|
0
|
|
my $self = shift; |
39
|
0
|
0
|
|
|
|
|
if (@_) { |
40
|
0
|
|
|
|
|
|
my $new_time = shift; |
41
|
0
|
0
|
|
|
|
|
return unless $new_time =~ /^\d+$/; |
42
|
0
|
|
|
|
|
|
$self->{time} = $new_time; |
43
|
|
|
|
|
|
|
} |
44
|
0
|
|
|
|
|
|
return $self->{time}; |
45
|
|
|
|
|
|
|
} |
46
|
|
|
|
|
|
|
|
47
|
|
|
|
|
|
|
sub type { |
48
|
0
|
|
|
0
|
1
|
|
my $self = shift; |
49
|
0
|
0
|
|
|
|
|
if (@_) { |
50
|
0
|
|
|
|
|
|
$self->{type} = shift; |
51
|
|
|
|
|
|
|
} |
52
|
0
|
|
|
|
|
|
return $self->{type}; |
53
|
|
|
|
|
|
|
} |
54
|
|
|
|
|
|
|
|
55
|
|
|
|
|
|
|
|
56
|
|
|
|
|
|
|
sub size { |
57
|
0
|
|
|
0
|
1
|
|
my $self = shift; |
58
|
0
|
0
|
|
|
|
|
if (@_) { |
59
|
0
|
|
|
|
|
|
my $new_size = shift; |
60
|
0
|
0
|
|
|
|
|
return unless $new_size =~ /^\d+(\.\d+)?$/; |
61
|
0
|
|
|
|
|
|
$self->{size} = $new_size; |
62
|
|
|
|
|
|
|
} |
63
|
0
|
|
|
|
|
|
return $self->{size}; |
64
|
|
|
|
|
|
|
} |
65
|
|
|
|
|
|
|
|
66
|
|
|
|
|
|
|
sub size_units { |
67
|
0
|
|
|
0
|
1
|
|
my $self = shift; |
68
|
0
|
0
|
|
|
|
|
if (@_) { |
69
|
0
|
|
|
|
|
|
$self->{size_units} = shift; |
70
|
|
|
|
|
|
|
} |
71
|
0
|
|
|
|
|
|
return $self->{size_units}; |
72
|
|
|
|
|
|
|
} |
73
|
|
|
|
|
|
|
|
74
|
|
|
|
|
|
|
sub _as_string { |
75
|
0
|
|
|
0
|
|
|
my $self = shift; |
76
|
0
|
|
|
|
|
|
my $string; |
77
|
0
|
0
|
|
|
|
|
$string.= sprintf "Filename : %s\n", $self->filename if defined $self->filename; |
78
|
0
|
0
|
|
|
|
|
$string.= sprintf "Size : %s\n", $self->size if defined $self->size; |
79
|
0
|
0
|
|
|
|
|
$string.= sprintf "Size Units: %s\n", $self->size_units if defined $self->size_units; |
80
|
0
|
0
|
|
|
|
|
$string.= sprintf "Type : %s\n", $self->type if defined $self->type; |
81
|
0
|
0
|
|
|
|
|
$string.= sprintf "URL : %s\n", $self->url if defined $self->url; |
82
|
0
|
0
|
|
|
|
|
$string.= sprintf "Time : %s\n", scalar localtime($self->time) if defined $self->time; |
83
|
0
|
|
|
|
|
|
return $string; |
84
|
|
|
|
|
|
|
} |
85
|
|
|
|
|
|
|
|
86
|
|
|
|
|
|
|
=head1 NAME |
87
|
|
|
|
|
|
|
|
88
|
|
|
|
|
|
|
WWW::IndexParser::Entry - Object representing an item in a directory |
89
|
|
|
|
|
|
|
|
90
|
|
|
|
|
|
|
=head1 SYNOPSIS |
91
|
|
|
|
|
|
|
|
92
|
|
|
|
|
|
|
my @files = WWW::IndexParser->new('http://www.james.rcpt.to/misc/'); |
93
|
|
|
|
|
|
|
foreach my $file (@files) { |
94
|
|
|
|
|
|
|
print $file->url; |
95
|
|
|
|
|
|
|
} |
96
|
|
|
|
|
|
|
|
97
|
|
|
|
|
|
|
=head1 DESCRIPTION |
98
|
|
|
|
|
|
|
|
99
|
|
|
|
|
|
|
|
100
|
|
|
|
|
|
|
B is not used directly, but is the class of |
101
|
|
|
|
|
|
|
items returned by B when it successfully parses an |
102
|
|
|
|
|
|
|
auto index from a web server. |
103
|
|
|
|
|
|
|
|
104
|
|
|
|
|
|
|
|
105
|
|
|
|
|
|
|
=head1 METHODS |
106
|
|
|
|
|
|
|
|
107
|
|
|
|
|
|
|
=over 4 |
108
|
|
|
|
|
|
|
|
109
|
|
|
|
|
|
|
=item filename |
110
|
|
|
|
|
|
|
|
111
|
|
|
|
|
|
|
=item url |
112
|
|
|
|
|
|
|
|
113
|
|
|
|
|
|
|
=item size |
114
|
|
|
|
|
|
|
|
115
|
|
|
|
|
|
|
=item size_units |
116
|
|
|
|
|
|
|
|
117
|
|
|
|
|
|
|
=item type |
118
|
|
|
|
|
|
|
|
119
|
|
|
|
|
|
|
=back |
120
|
|
|
|
|
|
|
|
121
|
|
|
|
|
|
|
|
122
|
|
|
|
|
|
|
=head1 OSNAMES |
123
|
|
|
|
|
|
|
|
124
|
|
|
|
|
|
|
any |
125
|
|
|
|
|
|
|
|
126
|
|
|
|
|
|
|
=head1 AUTHOR |
127
|
|
|
|
|
|
|
|
128
|
|
|
|
|
|
|
James Bromberger Ejames@rcpt.toE |
129
|
|
|
|
|
|
|
|
130
|
|
|
|
|
|
|
=head1 COPYRIGHT |
131
|
|
|
|
|
|
|
|
132
|
|
|
|
|
|
|
Copyright (c) 2005 James Bromberger. All rights reserved. All rights |
133
|
|
|
|
|
|
|
reserved. This program is free software; you can redistribute it and/or |
134
|
|
|
|
|
|
|
modify it under the same terms as Perl itself. |
135
|
|
|
|
|
|
|
|
136
|
|
|
|
|
|
|
=cut |
137
|
|
|
|
|
|
|
|
138
|
|
|
|
|
|
|
1; |
139
|
|
|
|
|
|
|
|
140
|
|
|
|
|
|
|
1; |