line |
stmt |
bran |
cond |
sub |
pod |
time |
code |
1
|
|
|
|
|
|
|
# $Id: /mirror/perl/GunghoX-FollowLinks/trunk/lib/GunghoX/FollowLinks/Rule/HTML/SelectedTags.pm 8893 2007-11-10T14:30:51.466577Z daisuke $ |
2
|
|
|
|
|
|
|
# |
3
|
|
|
|
|
|
|
# Copyright (c) 2007 Daisuke Maki <daisuke@endeworks.jp> |
4
|
|
|
|
|
|
|
# All rights reserved. |
5
|
|
|
|
|
|
|
|
6
|
|
|
|
|
|
|
package GunghoX::FollowLinks::Rule::HTML::SelectedTags; |
7
|
2
|
|
|
2
|
|
23411
|
use strict; |
|
2
|
|
|
|
|
2
|
|
|
2
|
|
|
|
|
46
|
|
8
|
2
|
|
|
2
|
|
6
|
use warnings; |
|
2
|
|
|
|
|
3
|
|
|
2
|
|
|
|
|
42
|
|
9
|
2
|
|
|
2
|
|
7
|
use base qw(GunghoX::FollowLinks::Rule); |
|
2
|
|
|
|
|
3
|
|
|
2
|
|
|
|
|
449
|
|
10
|
|
|
|
|
|
|
|
11
|
|
|
|
|
|
|
__PACKAGE__->mk_accessors($_) for qw(tags); |
12
|
|
|
|
|
|
|
|
13
|
|
|
|
|
|
|
sub apply |
14
|
|
|
|
|
|
|
{ |
15
|
0
|
|
|
0
|
1
|
|
my ($self, $c, $response, $url, $attrs) = @_; |
16
|
|
|
|
|
|
|
|
17
|
0
|
|
0
|
|
|
|
my $tags = $self->tags || []; |
18
|
0
|
|
0
|
|
|
|
my $tag = $attrs->{tag} || ''; |
19
|
|
|
|
|
|
|
|
20
|
0
|
|
|
|
|
|
foreach my $want (@$tags) { |
21
|
0
|
0
|
|
|
|
|
return &GunghoX::FollowLinks::Rule::FOLLOW_ALLOW if $tag eq $want; |
22
|
|
|
|
|
|
|
} |
23
|
0
|
|
|
|
|
|
return &GunghoX::FollowLinks::Rule::FOLLOW_DENY; |
24
|
|
|
|
|
|
|
} |
25
|
|
|
|
|
|
|
|
26
|
|
|
|
|
|
|
1; |
27
|
|
|
|
|
|
|
|
28
|
|
|
|
|
|
|
__END__ |
29
|
|
|
|
|
|
|
|
30
|
|
|
|
|
|
|
=head1 NAME |
31
|
|
|
|
|
|
|
|
32
|
|
|
|
|
|
|
GunghoX::FollowLinks::Rule::HTML::SelectedTags - Follow Only On Selected Tags |
33
|
|
|
|
|
|
|
|
34
|
|
|
|
|
|
|
=head1 SYNOPSIS |
35
|
|
|
|
|
|
|
|
36
|
|
|
|
|
|
|
GunghoX::FollowLinks::Rule::HTML::SelectedTags->new( |
37
|
|
|
|
|
|
|
tags => [ 'a', 'img' ] |
38
|
|
|
|
|
|
|
); |
39
|
|
|
|
|
|
|
|
40
|
|
|
|
|
|
|
=head1 METHODS |
41
|
|
|
|
|
|
|
|
42
|
|
|
|
|
|
|
=head2 apply($c, $response, $url, { tag => $tag, attrs => $attrs }) |
43
|
|
|
|
|
|
|
|
44
|
|
|
|
|
|
|
=cut |