line |
stmt |
bran |
cond |
sub |
pod |
time |
code |
1
|
|
|
|
|
|
|
=head1 NAME |
2
|
|
|
|
|
|
|
|
3
|
|
|
|
|
|
|
WWW::Link::Reporter::Text - Report on status of links in plain text |
4
|
|
|
|
|
|
|
|
5
|
|
|
|
|
|
|
=head1 SYNOPSIS |
6
|
|
|
|
|
|
|
|
7
|
|
|
|
|
|
|
use WWW::Link; |
8
|
|
|
|
|
|
|
use WWW::Link::Reporter::Text; |
9
|
|
|
|
|
|
|
|
10
|
|
|
|
|
|
|
$link=new WWW::Link; |
11
|
|
|
|
|
|
|
|
12
|
|
|
|
|
|
|
#over time do things to the link ...... |
13
|
|
|
|
|
|
|
|
14
|
|
|
|
|
|
|
$reporter = new WWW::Link::Reporter::Text |
15
|
|
|
|
|
|
|
$reporter->examine($link) |
16
|
|
|
|
|
|
|
|
17
|
|
|
|
|
|
|
=head1 DESCRIPTION |
18
|
|
|
|
|
|
|
|
19
|
|
|
|
|
|
|
This is a very simple class derived from WWW::Link::Reporter which provides |
20
|
|
|
|
|
|
|
a report on the status of links in text for easy reading. Nothing |
21
|
|
|
|
|
|
|
much can be done other than read it. |
22
|
|
|
|
|
|
|
|
23
|
|
|
|
|
|
|
=cut |
24
|
|
|
|
|
|
|
|
25
|
|
|
|
|
|
|
package WWW::Link::Reporter::Text; |
26
|
|
|
|
|
|
|
$REVISION=q$Revision: 1.9 $ ; $VERSION = sprintf ( "%d.%02d", $REVISION =~ /(\d+).(\d+)/ ); |
27
|
|
|
|
|
|
|
|
28
|
|
|
|
|
|
|
@ISA = qw(WWW::Link::Reporter); |
29
|
|
|
|
|
|
|
|
30
|
2
|
|
|
2
|
|
56986
|
use warnings; |
|
2
|
|
|
|
|
4
|
|
|
2
|
|
|
|
|
70
|
|
31
|
2
|
|
|
2
|
|
10
|
use strict; |
|
2
|
|
|
|
|
2
|
|
|
2
|
|
|
|
|
56
|
|
32
|
|
|
|
|
|
|
|
33
|
2
|
|
|
2
|
|
642
|
use WWW::Link::Reporter; |
|
2
|
|
|
|
|
4
|
|
|
2
|
|
|
|
|
86
|
|
34
|
2
|
|
|
2
|
|
15
|
use Carp; |
|
2
|
|
|
|
|
3
|
|
|
2
|
|
|
|
|
1974
|
|
35
|
|
|
|
|
|
|
|
36
|
|
|
|
|
|
|
sub broken { |
37
|
0
|
|
|
0
|
1
|
0
|
my $self=shift; |
38
|
0
|
|
|
|
|
0
|
my $link=shift; |
39
|
0
|
|
|
|
|
0
|
my $redir=shift; |
40
|
0
|
|
|
|
|
0
|
my $url=$link->url(); |
41
|
0
|
|
|
|
|
0
|
print "broken:- $url\n"; |
42
|
0
|
0
|
|
|
|
0
|
$redir && $self->redirections($link); |
43
|
0
|
|
|
|
|
0
|
$self->suggestions($link); |
44
|
0
|
0
|
|
|
|
0
|
if ($self->{"index"}) { |
45
|
0
|
|
|
|
|
0
|
my $page_array=$self->{"index"}->lookup_second($url); |
46
|
0
|
|
|
|
|
0
|
$self->page_list ( @$page_array ); |
47
|
|
|
|
|
|
|
} |
48
|
|
|
|
|
|
|
} |
49
|
|
|
|
|
|
|
|
50
|
|
|
|
|
|
|
sub not_found { |
51
|
0
|
|
|
0
|
1
|
0
|
my $self=shift; |
52
|
0
|
|
|
|
|
0
|
my $url=shift; |
53
|
0
|
|
|
|
|
0
|
print "Sorry, the link $url is not in the database.\n"; |
54
|
|
|
|
|
|
|
} |
55
|
|
|
|
|
|
|
|
56
|
|
|
|
|
|
|
sub okay { |
57
|
0
|
|
|
0
|
1
|
0
|
my $self=shift; |
58
|
0
|
|
|
|
|
0
|
my $link=shift; |
59
|
0
|
|
|
|
|
0
|
my $redir=shift; |
60
|
0
|
|
|
|
|
0
|
my $url=$link->url(); |
61
|
0
|
|
|
|
|
0
|
print "tested okay:- $url\n"; |
62
|
0
|
0
|
|
|
|
0
|
$redir && $self->redirections($link); |
63
|
0
|
|
|
|
|
0
|
$self->suggestions($link); |
64
|
0
|
0
|
|
|
|
0
|
if ($self->{"index"}) { |
65
|
0
|
|
|
|
|
0
|
my $page_array=$self->{"index"}->lookup_second($url); |
66
|
0
|
|
|
|
|
0
|
$self->page_list ( @$page_array ); |
67
|
|
|
|
|
|
|
} |
68
|
0
|
|
|
|
|
0
|
return 1; |
69
|
|
|
|
|
|
|
} |
70
|
|
|
|
|
|
|
|
71
|
|
|
|
|
|
|
sub damaged { |
72
|
0
|
|
|
0
|
1
|
0
|
my $self=shift; |
73
|
0
|
|
|
|
|
0
|
my $link=shift; |
74
|
0
|
|
|
|
|
0
|
my $redir=shift; |
75
|
0
|
|
|
|
|
0
|
my $url=$link->url(); |
76
|
0
|
|
|
|
|
0
|
print "could be broken:- $url\n"; |
77
|
0
|
0
|
|
|
|
0
|
$redir && $self->redirections($link); |
78
|
0
|
|
|
|
|
0
|
$self->suggestions($link); |
79
|
0
|
0
|
|
|
|
0
|
if ($self->{"index"}) { |
80
|
0
|
|
|
|
|
0
|
my $page_array=$self->{"index"}->lookup_second($url); |
81
|
0
|
|
|
|
|
0
|
$self->page_list ( @$page_array ); |
82
|
|
|
|
|
|
|
} |
83
|
0
|
|
|
|
|
0
|
return 1; |
84
|
|
|
|
|
|
|
} |
85
|
|
|
|
|
|
|
|
86
|
|
|
|
|
|
|
sub not_checked { |
87
|
0
|
|
|
0
|
1
|
0
|
my $self=shift; |
88
|
0
|
|
|
|
|
0
|
my $link=shift; |
89
|
0
|
|
|
|
|
0
|
my $url=$link->url(); |
90
|
0
|
|
|
|
|
0
|
print "not yet checked:- $url\n"; |
91
|
0
|
|
|
|
|
0
|
$self->suggestions($link); |
92
|
0
|
0
|
|
|
|
0
|
if ($self->{"index"}) { |
93
|
0
|
|
|
|
|
0
|
my $page_array=$self->{"index"}->lookup_second($url); |
94
|
0
|
|
|
|
|
0
|
$self->page_list ( @$page_array ); |
95
|
|
|
|
|
|
|
} |
96
|
|
|
|
|
|
|
} |
97
|
|
|
|
|
|
|
|
98
|
|
|
|
|
|
|
sub disallowed { |
99
|
0
|
|
|
0
|
1
|
0
|
my $self=shift; |
100
|
0
|
|
|
|
|
0
|
my $link=shift; |
101
|
0
|
|
|
|
|
0
|
my $url=$link->url(); |
102
|
0
|
|
|
|
|
0
|
print "checking disallowed:- $url\n"; |
103
|
0
|
|
|
|
|
0
|
$self->suggestions($link); |
104
|
0
|
0
|
|
|
|
0
|
if ($self->{"index"}) { |
105
|
0
|
|
|
|
|
0
|
my $page_array=$self->{"index"}->lookup_second($url); |
106
|
0
|
|
|
|
|
0
|
$self->page_list ( @$page_array ); |
107
|
|
|
|
|
|
|
} |
108
|
|
|
|
|
|
|
} |
109
|
|
|
|
|
|
|
|
110
|
|
|
|
|
|
|
sub unsupported { |
111
|
0
|
|
|
0
|
1
|
0
|
my $self=shift; |
112
|
0
|
|
|
|
|
0
|
my $link=shift; |
113
|
0
|
|
|
|
|
0
|
my $url=$link->url(); |
114
|
0
|
|
|
|
|
0
|
print "unsupported protocol:- $url\n"; |
115
|
0
|
|
|
|
|
0
|
$self->suggestions($link); |
116
|
0
|
0
|
|
|
|
0
|
if ($self->{"index"}) { |
117
|
0
|
|
|
|
|
0
|
my $page_array=$self->{"index"}->lookup_second($url); |
118
|
0
|
|
|
|
|
0
|
$self->page_list ( @$page_array ); |
119
|
|
|
|
|
|
|
} |
120
|
|
|
|
|
|
|
} |
121
|
|
|
|
|
|
|
|
122
|
|
|
|
|
|
|
sub unknown { |
123
|
0
|
|
|
0
|
1
|
0
|
my $self=shift; |
124
|
0
|
|
|
|
|
0
|
my $link=shift; |
125
|
0
|
|
|
|
|
0
|
my $url=$link->url(); |
126
|
0
|
|
|
|
|
0
|
print "unknown status (error?):- $url"; |
127
|
0
|
|
|
|
|
0
|
$self->suggestions($link); |
128
|
0
|
0
|
|
|
|
0
|
if ($self->{"index"}) { |
129
|
0
|
|
|
|
|
0
|
my $page_array=$self->{"index"}->lookup_second($url); |
130
|
0
|
|
|
|
|
0
|
$self->page_list ( @$page_array ); |
131
|
|
|
|
|
|
|
} |
132
|
|
|
|
|
|
|
} |
133
|
|
|
|
|
|
|
|
134
|
|
|
|
|
|
|
|
135
|
|
|
|
|
|
|
sub redirections { |
136
|
2
|
|
|
2
|
0
|
331
|
my $self=shift; |
137
|
2
|
|
|
|
|
4
|
my $link=shift; |
138
|
2
|
|
|
|
|
7
|
my @redirects=$link->redirect_urls(); |
139
|
2
|
|
|
|
|
4
|
foreach my $redir ( @redirects ) { |
140
|
2
|
|
|
|
|
10
|
print "redirected to\t$redir\n"; |
141
|
|
|
|
|
|
|
} |
142
|
|
|
|
|
|
|
} |
143
|
|
|
|
|
|
|
|
144
|
|
|
|
|
|
|
|
145
|
|
|
|
|
|
|
sub suggestions { |
146
|
0
|
|
|
0
|
0
|
|
my $self=shift; |
147
|
0
|
|
|
|
|
|
my $link=shift; |
148
|
0
|
|
|
|
|
|
my $suggestions=$link->fix_suggestions(); |
149
|
0
|
0
|
|
|
|
|
if ($suggestions) { |
150
|
0
|
|
|
|
|
|
foreach my $suggest ( @{$suggestions} ) { |
|
0
|
|
|
|
|
|
|
151
|
0
|
|
|
|
|
|
print "suggest $suggest\n"; |
152
|
|
|
|
|
|
|
} |
153
|
|
|
|
|
|
|
} |
154
|
0
|
|
|
|
|
|
return 1; |
155
|
|
|
|
|
|
|
} |
156
|
|
|
|
|
|
|
|
157
|
|
|
|
|
|
|
|
158
|
|
|
|
|
|
|
sub page_list { |
159
|
0
|
|
|
0
|
0
|
|
my $self=shift; |
160
|
0
|
|
|
|
|
|
foreach (@_) { |
161
|
0
|
|
|
|
|
|
print " $_\n"; |
162
|
|
|
|
|
|
|
} |
163
|
|
|
|
|
|
|
} |
164
|
|
|
|
|
|
|
|
165
|
|
|
|
|
|
|
1; |
166
|
|
|
|
|
|
|
|
167
|
|
|
|
|
|
|
|
168
|
|
|
|
|
|
|
|