line |
stmt |
bran |
cond |
sub |
pod |
time |
code |
1
|
|
|
|
|
|
|
# $Id: /mirror/perl/GunghoX-FollowLinks/trunk/lib/GunghoX/FollowLinks/Rule.pm 8918 2007-11-12T03:02:15.291385Z daisuke $ |
2
|
|
|
|
|
|
|
# |
3
|
|
|
|
|
|
|
# Copyright (c) 2007 Daisuke Maki <daisuke@endeworks.jp> |
4
|
|
|
|
|
|
|
# All rights reserved. |
5
|
|
|
|
|
|
|
|
6
|
|
|
|
|
|
|
package GunghoX::FollowLinks::Rule; |
7
|
5
|
|
|
5
|
|
284182
|
use strict; |
|
5
|
|
|
|
|
9
|
|
|
5
|
|
|
|
|
112
|
|
8
|
5
|
|
|
5
|
|
15
|
use warnings; |
|
5
|
|
|
|
|
6
|
|
|
5
|
|
|
|
|
105
|
|
9
|
5
|
|
|
5
|
|
14
|
use base qw(Gungho::Base); |
|
5
|
|
|
|
|
5
|
|
|
5
|
|
|
|
|
982
|
|
10
|
|
|
|
|
|
|
|
11
|
5
|
|
|
|
|
33
|
use Sub::Exporter -setup => { |
12
|
|
|
|
|
|
|
exports => [ qw(FOLLOW_ALLOW FOLLOW_DENY FOLLOW_DEFER) ] |
13
|
5
|
|
|
5
|
|
11517
|
}; |
|
5
|
|
|
|
|
35782
|
|
14
|
5
|
|
|
5
|
|
1253
|
use constant FOLLOW_ALLOW => "FOLLOW_ALLOW"; |
|
5
|
|
|
|
|
8
|
|
|
5
|
|
|
|
|
324
|
|
15
|
5
|
|
|
5
|
|
17
|
use constant FOLLOW_DENY => "FOLLOW_DENY"; |
|
5
|
|
|
|
|
7
|
|
|
5
|
|
|
|
|
167
|
|
16
|
5
|
|
|
5
|
|
16
|
use constant FOLLOW_DEFER => "FOLLOW_DEFER"; |
|
5
|
|
|
|
|
6
|
|
|
5
|
|
|
|
|
249
|
|
17
|
|
|
|
|
|
|
|
18
|
0
|
|
|
0
|
1
|
|
sub apply { die "You must override apply()" } |
19
|
|
|
|
|
|
|
|
20
|
|
|
|
|
|
|
1; |
21
|
|
|
|
|
|
|
|
22
|
|
|
|
|
|
|
__END__ |
23
|
|
|
|
|
|
|
|
24
|
|
|
|
|
|
|
=head1 NAME |
25
|
|
|
|
|
|
|
|
26
|
|
|
|
|
|
|
GunghoX::FollowLinks::Rule - Rule To Decide If A Link Should Be Followed |
27
|
|
|
|
|
|
|
|
28
|
|
|
|
|
|
|
=head1 SYNOPSIS |
29
|
|
|
|
|
|
|
|
30
|
|
|
|
|
|
|
use GunghoX::FollowLinks::Rule q(FOLLOW_ALLOW FOLLOW_DENY FOLLOW_DEFER); |
31
|
|
|
|
|
|
|
|
32
|
|
|
|
|
|
|
package MyRule; |
33
|
|
|
|
|
|
|
use base qw(GunghoX::FollowLinks::Rule); |
34
|
|
|
|
|
|
|
|
35
|
|
|
|
|
|
|
sub apply { |
36
|
|
|
|
|
|
|
# custom logic |
37
|
|
|
|
|
|
|
} |
38
|
|
|
|
|
|
|
|
39
|
|
|
|
|
|
|
=head1 CONSTANTS |
40
|
|
|
|
|
|
|
|
41
|
|
|
|
|
|
|
=head2 FOLLOW_ALLOW |
42
|
|
|
|
|
|
|
|
43
|
|
|
|
|
|
|
=head2 FOLLOW_DENY |
44
|
|
|
|
|
|
|
|
45
|
|
|
|
|
|
|
=head2 FOLLOW_DEFER |
46
|
|
|
|
|
|
|
|
47
|
|
|
|
|
|
|
=head1 METHODS |
48
|
|
|
|
|
|
|
|
49
|
|
|
|
|
|
|
=head2 apply |
50
|
|
|
|
|
|
|
|
51
|
|
|
|
|
|
|
Subclasses must override this method. The exact arguments change depending |
52
|
|
|
|
|
|
|
on the GunghoX::FollowLinks::Parser object being used, but the first two |
53
|
|
|
|
|
|
|
elements are always the global Gungho context and the Gungho::Response |
54
|
|
|
|
|
|
|
object. |
55
|
|
|
|
|
|
|
|
56
|
|
|
|
|
|
|
=cut |