| line |
stmt |
bran |
cond |
sub |
pod |
time |
code |
|
1
|
|
|
|
|
|
|
package DNS::RName::Converter; |
|
2
|
|
|
|
|
|
|
|
|
3
|
1
|
|
|
1
|
|
30839
|
use 5.006; |
|
|
1
|
|
|
|
|
5
|
|
|
|
1
|
|
|
|
|
49
|
|
|
4
|
1
|
|
|
1
|
|
7
|
use strict; |
|
|
1
|
|
|
|
|
2
|
|
|
|
1
|
|
|
|
|
42
|
|
|
5
|
1
|
|
|
1
|
|
6
|
use warnings; |
|
|
1
|
|
|
|
|
7
|
|
|
|
1
|
|
|
|
|
39
|
|
|
6
|
1
|
|
|
1
|
|
1130
|
use Data::Validate::Email qw(is_email); |
|
|
1
|
|
|
|
|
98452
|
|
|
|
1
|
|
|
|
|
81
|
|
|
7
|
1
|
|
|
1
|
|
14
|
use Carp qw/croak/; |
|
|
1
|
|
|
|
|
4
|
|
|
|
1
|
|
|
|
|
57
|
|
|
8
|
1
|
|
|
1
|
|
7
|
use vars qw/$VERSION/; |
|
|
1
|
|
|
|
|
3
|
|
|
|
1
|
|
|
|
|
372
|
|
|
9
|
|
|
|
|
|
|
|
|
10
|
|
|
|
|
|
|
$VERSION = '0.01'; |
|
11
|
|
|
|
|
|
|
|
|
12
|
|
|
|
|
|
|
sub new { |
|
13
|
0
|
|
|
0
|
1
|
|
my $class = shift; |
|
14
|
0
|
|
|
|
|
|
bless {},$class; |
|
15
|
|
|
|
|
|
|
} |
|
16
|
|
|
|
|
|
|
|
|
17
|
|
|
|
|
|
|
sub email_to_rname { |
|
18
|
0
|
|
|
0
|
1
|
|
my $self = shift; |
|
19
|
0
|
|
|
|
|
|
my $email = shift; |
|
20
|
|
|
|
|
|
|
|
|
21
|
0
|
0
|
|
|
|
|
if ( is_email($email) ) { |
|
22
|
0
|
|
|
|
|
|
my ($user,$tld) = split/\@/,$email; |
|
23
|
0
|
|
|
|
|
|
$user =~ s/\./\\./g; |
|
24
|
0
|
|
|
|
|
|
return $user. '.' .$tld . '.'; |
|
25
|
|
|
|
|
|
|
|
|
26
|
|
|
|
|
|
|
} else { |
|
27
|
0
|
|
|
|
|
|
croak "you have input a wrong email address"; |
|
28
|
|
|
|
|
|
|
} |
|
29
|
|
|
|
|
|
|
} |
|
30
|
|
|
|
|
|
|
|
|
31
|
|
|
|
|
|
|
sub rname_to_email { |
|
32
|
0
|
|
|
0
|
1
|
|
my $self = shift; |
|
33
|
0
|
|
|
|
|
|
my $rname = shift; |
|
34
|
0
|
|
|
|
|
|
$rname =~ s/\.$//; |
|
35
|
|
|
|
|
|
|
|
|
36
|
0
|
0
|
|
|
|
|
if ($rname =~ /^(.*?)(?
|
|
37
|
0
|
|
|
|
|
|
my $user = $1; |
|
38
|
0
|
|
|
|
|
|
my $tld = $2; |
|
39
|
0
|
|
|
|
|
|
$user =~ s/\\//g; |
|
40
|
0
|
|
|
|
|
|
return $user . '@' . $tld; |
|
41
|
|
|
|
|
|
|
|
|
42
|
|
|
|
|
|
|
} else { |
|
43
|
0
|
|
|
|
|
|
croak "you have input a wrong rname"; |
|
44
|
|
|
|
|
|
|
} |
|
45
|
|
|
|
|
|
|
} |
|
46
|
|
|
|
|
|
|
|
|
47
|
|
|
|
|
|
|
1; |
|
48
|
|
|
|
|
|
|
|
|
49
|
|
|
|
|
|
|
=head1 NAME |
|
50
|
|
|
|
|
|
|
|
|
51
|
|
|
|
|
|
|
DNS::RName::Converter - converting between email and rname for DNS SOA record |
|
52
|
|
|
|
|
|
|
|
|
53
|
|
|
|
|
|
|
=head1 VERSION |
|
54
|
|
|
|
|
|
|
|
|
55
|
|
|
|
|
|
|
Version 0.01 |
|
56
|
|
|
|
|
|
|
|
|
57
|
|
|
|
|
|
|
|
|
58
|
|
|
|
|
|
|
=head1 SYNOPSIS |
|
59
|
|
|
|
|
|
|
|
|
60
|
|
|
|
|
|
|
use DNS::RName::Converter; |
|
61
|
|
|
|
|
|
|
|
|
62
|
|
|
|
|
|
|
my $cvt = DNS::RName::Converter->new; |
|
63
|
|
|
|
|
|
|
my $rname = $cvt->email_to_rname($email); |
|
64
|
|
|
|
|
|
|
my $email = $cvt->rname_to_email($rname); |
|
65
|
|
|
|
|
|
|
|
|
66
|
|
|
|
|
|
|
|
|
67
|
|
|
|
|
|
|
=head1 METHODS |
|
68
|
|
|
|
|
|
|
|
|
69
|
|
|
|
|
|
|
=head2 new() |
|
70
|
|
|
|
|
|
|
|
|
71
|
|
|
|
|
|
|
Initialize the object. |
|
72
|
|
|
|
|
|
|
|
|
73
|
|
|
|
|
|
|
=head2 email_to_rname(email_address) |
|
74
|
|
|
|
|
|
|
|
|
75
|
|
|
|
|
|
|
Convert the email address to the rName for SOA record. |
|
76
|
|
|
|
|
|
|
|
|
77
|
|
|
|
|
|
|
=head2 rname_to_email(rName) |
|
78
|
|
|
|
|
|
|
|
|
79
|
|
|
|
|
|
|
Convert the rName from SOA to the standard email address. |
|
80
|
|
|
|
|
|
|
|
|
81
|
|
|
|
|
|
|
|
|
82
|
|
|
|
|
|
|
=head1 SEE ALSO |
|
83
|
|
|
|
|
|
|
|
|
84
|
|
|
|
|
|
|
http://www.ripe.net/ripe/docs/ripe-203 |
|
85
|
|
|
|
|
|
|
|
|
86
|
|
|
|
|
|
|
|
|
87
|
|
|
|
|
|
|
=head1 AUTHOR |
|
88
|
|
|
|
|
|
|
|
|
89
|
|
|
|
|
|
|
Ken Peng |
|
90
|
|
|
|
|
|
|
|
|
91
|
|
|
|
|
|
|
|
|
92
|
|
|
|
|
|
|
=head1 BUGS/LIMITATIONS |
|
93
|
|
|
|
|
|
|
|
|
94
|
|
|
|
|
|
|
If you have found bugs, please send email to |
|
95
|
|
|
|
|
|
|
|
|
96
|
|
|
|
|
|
|
|
|
97
|
|
|
|
|
|
|
=head1 SUPPORT |
|
98
|
|
|
|
|
|
|
|
|
99
|
|
|
|
|
|
|
You can find documentation for this module with the perldoc command. |
|
100
|
|
|
|
|
|
|
|
|
101
|
|
|
|
|
|
|
perldoc DNS::RName::Converter |
|
102
|
|
|
|
|
|
|
|
|
103
|
|
|
|
|
|
|
|
|
104
|
|
|
|
|
|
|
=head1 COPYRIGHT & LICENSE |
|
105
|
|
|
|
|
|
|
|
|
106
|
|
|
|
|
|
|
Copyright 2014 Ken Peng, all rights reserved. |
|
107
|
|
|
|
|
|
|
|
|
108
|
|
|
|
|
|
|
This program is free software; you can redistribute it and/or modify |
|
109
|
|
|
|
|
|
|
it under the same terms as Perl itself. |
|
110
|
|
|
|
|
|
|
|