line |
stmt |
bran |
cond |
sub |
pod |
time |
code |
1
|
|
|
|
|
|
|
# Copyright (c) 2003-2004 Timothy Appnel (cpan@timaoutloud.org) |
2
|
|
|
|
|
|
|
# http://www.timaoutloud.org/ |
3
|
|
|
|
|
|
|
# This code is released under the Artistic License. |
4
|
|
|
|
|
|
|
package Net::Trackback; |
5
|
1
|
|
|
1
|
|
7914
|
use strict; |
|
1
|
|
|
|
|
2
|
|
|
1
|
|
|
|
|
37
|
|
6
|
1
|
|
|
1
|
|
5
|
use base qw( Class::ErrorHandler Exporter ); |
|
1
|
|
|
|
|
2
|
|
|
1
|
|
|
|
|
2275
|
|
7
|
|
|
|
|
|
|
|
8
|
1
|
|
|
1
|
|
416
|
use vars qw( @EXPORT_OK ); |
|
1
|
|
|
|
|
15
|
|
|
1
|
|
|
|
|
49
|
|
9
|
|
|
|
|
|
|
@EXPORT_OK = qw( encode_xml decode_xml ); |
10
|
|
|
|
|
|
|
|
11
|
1
|
|
|
1
|
|
6
|
use vars qw($VERSION); |
|
1
|
|
|
|
|
2
|
|
|
1
|
|
|
|
|
306
|
|
12
|
|
|
|
|
|
|
$VERSION = 1.01; |
13
|
|
|
|
|
|
|
|
14
|
|
|
|
|
|
|
my %Map = ('&' => '&', '"' => '"', '<' => '<', '>' => '>', |
15
|
|
|
|
|
|
|
'\'' => '''); |
16
|
|
|
|
|
|
|
my %Map_Decode = reverse %Map; |
17
|
|
|
|
|
|
|
$Map{'\''}='''; |
18
|
|
|
|
|
|
|
my $RE = join '|', keys %Map; |
19
|
|
|
|
|
|
|
my $RE_D = join '|', keys %Map_Decode; |
20
|
|
|
|
|
|
|
|
21
|
|
|
|
|
|
|
sub encode_xml { |
22
|
0
|
0
|
|
0
|
1
|
|
return unless $_[1]; |
23
|
0
|
|
|
|
|
|
(my $str = $_[1]) =~ s!($RE)!$Map{$1}!g; |
24
|
0
|
|
|
|
|
|
$str; |
25
|
|
|
|
|
|
|
} |
26
|
|
|
|
|
|
|
|
27
|
|
|
|
|
|
|
sub decode_xml { |
28
|
0
|
0
|
|
0
|
1
|
|
return unless $_[1]; |
29
|
0
|
|
|
|
|
|
(my $str = $_[1]) =~ s!($RE_D)!$Map_Decode{$1}!g; |
30
|
0
|
|
|
|
|
|
$str; |
31
|
|
|
|
|
|
|
} |
32
|
|
|
|
|
|
|
|
33
|
|
|
|
|
|
|
|
34
|
|
|
|
|
|
|
#--- deprecated |
35
|
0
|
|
|
0
|
1
|
|
sub is_message { ref($_[1]) eq 'Net::Trackback::Message' } |
36
|
0
|
|
|
0
|
1
|
|
sub is_ping { ref($_[1]) eq 'Net::Trackback::Ping' } |
37
|
0
|
|
|
0
|
1
|
|
sub is_data { ref($_[1]) eq 'Net::Trackback::Data' } |
38
|
|
|
|
|
|
|
|
39
|
|
|
|
|
|
|
1; |
40
|
|
|
|
|
|
|
|
41
|
|
|
|
|
|
|
__END__ |