| line |
stmt |
bran |
cond |
sub |
pod |
time |
code |
|
1
|
|
|
|
|
|
|
package URL::Transform::using::Remove; |
|
2
|
|
|
|
|
|
|
|
|
3
|
|
|
|
|
|
|
=head1 NAME |
|
4
|
|
|
|
|
|
|
|
|
5
|
|
|
|
|
|
|
URL::Transform::using::Remove - no url transformation just remove the content |
|
6
|
|
|
|
|
|
|
|
|
7
|
|
|
|
|
|
|
=head1 SYNOPSIS |
|
8
|
|
|
|
|
|
|
|
|
9
|
|
|
|
|
|
|
my $urlt = URL::Transform::using::Remove->new( |
|
10
|
|
|
|
|
|
|
'output_function' => sub { $output .= "@_" }, |
|
11
|
|
|
|
|
|
|
); |
|
12
|
|
|
|
|
|
|
$urlt->parse_string("window.location='http://perl.org';"); |
|
13
|
|
|
|
|
|
|
|
|
14
|
|
|
|
|
|
|
print "and this is the output: ", $output; |
|
15
|
|
|
|
|
|
|
|
|
16
|
|
|
|
|
|
|
|
|
17
|
|
|
|
|
|
|
=head1 DESCRIPTION |
|
18
|
|
|
|
|
|
|
|
|
19
|
|
|
|
|
|
|
Using module you can performs an url transformation by removing everything! |
|
20
|
|
|
|
|
|
|
It's quite safe! ;-) |
|
21
|
|
|
|
|
|
|
|
|
22
|
|
|
|
|
|
|
This module is used by L to remove all JavaScript from |
|
23
|
|
|
|
|
|
|
the HTML documents as it is nearly impossible to update urls inside the |
|
24
|
|
|
|
|
|
|
JavaScript using generic way. |
|
25
|
|
|
|
|
|
|
|
|
26
|
|
|
|
|
|
|
=cut |
|
27
|
|
|
|
|
|
|
|
|
28
|
2
|
|
|
2
|
|
53503
|
use warnings; |
|
|
2
|
|
|
|
|
4
|
|
|
|
2
|
|
|
|
|
80
|
|
|
29
|
2
|
|
|
2
|
|
12
|
use strict; |
|
|
2
|
|
|
|
|
6
|
|
|
|
2
|
|
|
|
|
116
|
|
|
30
|
|
|
|
|
|
|
|
|
31
|
|
|
|
|
|
|
our $VERSION = '0.01'; |
|
32
|
|
|
|
|
|
|
|
|
33
|
2
|
|
|
2
|
|
796
|
use Carp::Clan 'croak'; |
|
|
2
|
|
|
|
|
4819
|
|
|
|
2
|
|
|
|
|
20
|
|
|
34
|
|
|
|
|
|
|
|
|
35
|
2
|
|
|
2
|
|
397
|
use base 'Class::Accessor::Fast'; |
|
|
2
|
|
|
|
|
4
|
|
|
|
2
|
|
|
|
|
1263
|
|
|
36
|
|
|
|
|
|
|
|
|
37
|
|
|
|
|
|
|
|
|
38
|
|
|
|
|
|
|
=head1 PROPERTIES |
|
39
|
|
|
|
|
|
|
|
|
40
|
|
|
|
|
|
|
output_function |
|
41
|
|
|
|
|
|
|
transform_function |
|
42
|
|
|
|
|
|
|
|
|
43
|
|
|
|
|
|
|
=cut |
|
44
|
|
|
|
|
|
|
|
|
45
|
|
|
|
|
|
|
__PACKAGE__->mk_accessors(qw{ |
|
46
|
|
|
|
|
|
|
output_function |
|
47
|
|
|
|
|
|
|
transform_function |
|
48
|
|
|
|
|
|
|
}); |
|
49
|
|
|
|
|
|
|
|
|
50
|
|
|
|
|
|
|
=head1 METHODS |
|
51
|
|
|
|
|
|
|
|
|
52
|
|
|
|
|
|
|
=head2 new |
|
53
|
|
|
|
|
|
|
|
|
54
|
|
|
|
|
|
|
Object constructor. |
|
55
|
|
|
|
|
|
|
|
|
56
|
|
|
|
|
|
|
Requires: |
|
57
|
|
|
|
|
|
|
|
|
58
|
|
|
|
|
|
|
output_function |
|
59
|
|
|
|
|
|
|
|
|
60
|
|
|
|
|
|
|
=cut |
|
61
|
|
|
|
|
|
|
|
|
62
|
|
|
|
|
|
|
sub new { |
|
63
|
6
|
|
|
6
|
1
|
94
|
my $class = shift; |
|
64
|
|
|
|
|
|
|
|
|
65
|
6
|
|
|
|
|
42
|
my $self = $class->SUPER::new({ @_ }); |
|
66
|
|
|
|
|
|
|
|
|
67
|
6
|
|
|
|
|
70
|
my $output_function = $self->output_function; |
|
68
|
|
|
|
|
|
|
# my $transform_function = $self->transform_function; |
|
69
|
|
|
|
|
|
|
|
|
70
|
6
|
50
|
|
|
|
44
|
croak 'pass print function' |
|
71
|
|
|
|
|
|
|
if not (ref $output_function eq 'CODE'); |
|
72
|
|
|
|
|
|
|
|
|
73
|
|
|
|
|
|
|
# croak 'pass transform url function' |
|
74
|
|
|
|
|
|
|
# if not (ref $transform_function eq 'CODE'); |
|
75
|
|
|
|
|
|
|
|
|
76
|
6
|
|
|
|
|
17
|
return $self; |
|
77
|
|
|
|
|
|
|
} |
|
78
|
|
|
|
|
|
|
|
|
79
|
|
|
|
|
|
|
|
|
80
|
|
|
|
|
|
|
=head2 parse_string($string) |
|
81
|
|
|
|
|
|
|
|
|
82
|
|
|
|
|
|
|
Pass empty string to output_function. |
|
83
|
|
|
|
|
|
|
|
|
84
|
|
|
|
|
|
|
=cut |
|
85
|
|
|
|
|
|
|
|
|
86
|
|
|
|
|
|
|
sub parse_string { |
|
87
|
7
|
|
|
7
|
1
|
27
|
my $self = shift; |
|
88
|
7
|
|
|
|
|
7
|
my $string = shift; |
|
89
|
|
|
|
|
|
|
|
|
90
|
7
|
|
|
|
|
18
|
$self->output_function->(''); |
|
91
|
|
|
|
|
|
|
} |
|
92
|
|
|
|
|
|
|
|
|
93
|
|
|
|
|
|
|
|
|
94
|
|
|
|
|
|
|
=head2 parse_chunk($string) |
|
95
|
|
|
|
|
|
|
|
|
96
|
|
|
|
|
|
|
Pass empty string to output_function. |
|
97
|
|
|
|
|
|
|
|
|
98
|
|
|
|
|
|
|
=cut |
|
99
|
|
|
|
|
|
|
|
|
100
|
|
|
|
|
|
|
sub parse_chunk { |
|
101
|
0
|
|
|
0
|
1
|
|
my $self = shift; |
|
102
|
|
|
|
|
|
|
|
|
103
|
0
|
|
|
|
|
|
$self->output_function->(''); |
|
104
|
|
|
|
|
|
|
} |
|
105
|
|
|
|
|
|
|
|
|
106
|
|
|
|
|
|
|
|
|
107
|
|
|
|
|
|
|
=head2 parse_file($file_name) |
|
108
|
|
|
|
|
|
|
|
|
109
|
|
|
|
|
|
|
Pass empty string to output_function. |
|
110
|
|
|
|
|
|
|
|
|
111
|
|
|
|
|
|
|
=cut |
|
112
|
|
|
|
|
|
|
|
|
113
|
|
|
|
|
|
|
sub parse_file { |
|
114
|
0
|
|
|
0
|
1
|
|
my $self = shift; |
|
115
|
|
|
|
|
|
|
|
|
116
|
0
|
|
|
|
|
|
$self->output_function->(''); |
|
117
|
|
|
|
|
|
|
} |
|
118
|
|
|
|
|
|
|
|
|
119
|
|
|
|
|
|
|
|
|
120
|
|
|
|
|
|
|
1; |
|
121
|
|
|
|
|
|
|
|
|
122
|
|
|
|
|
|
|
|
|
123
|
|
|
|
|
|
|
__END__ |