line |
stmt |
bran |
cond |
sub |
pod |
time |
code |
1
|
|
|
|
|
|
|
=head1 NAME |
2
|
|
|
|
|
|
|
|
3
|
|
|
|
|
|
|
Mail::Addressbook::Convert::PersistentUtilities |
4
|
|
|
|
|
|
|
|
5
|
|
|
|
|
|
|
=head1 SYNOPSIS |
6
|
|
|
|
|
|
|
|
7
|
|
|
|
|
|
|
This module is not designed to be used by the user. |
8
|
|
|
|
|
|
|
|
9
|
|
|
|
|
|
|
It provides a method with values that persist between calls. |
10
|
|
|
|
|
|
|
|
11
|
|
|
|
|
|
|
=head1 REQUIRES |
12
|
|
|
|
|
|
|
|
13
|
|
|
|
|
|
|
Perl, version 5.001 or higher |
14
|
|
|
|
|
|
|
|
15
|
|
|
|
|
|
|
Carp |
16
|
|
|
|
|
|
|
|
17
|
|
|
|
|
|
|
=head1 DESCRIPTION |
18
|
|
|
|
|
|
|
|
19
|
|
|
|
|
|
|
|
20
|
|
|
|
|
|
|
=head1 DEFINITIONS |
21
|
|
|
|
|
|
|
|
22
|
|
|
|
|
|
|
|
23
|
|
|
|
|
|
|
|
24
|
|
|
|
|
|
|
=head1 METHODS |
25
|
|
|
|
|
|
|
|
26
|
|
|
|
|
|
|
=head2 new |
27
|
|
|
|
|
|
|
|
28
|
|
|
|
|
|
|
no arguments needed. |
29
|
|
|
|
|
|
|
|
30
|
|
|
|
|
|
|
=head2 makeAliasUnique |
31
|
|
|
|
|
|
|
|
32
|
|
|
|
|
|
|
Input |
33
|
|
|
|
|
|
|
|
34
|
|
|
|
|
|
|
Parameter 1 : A email alias ( string ) |
35
|
|
|
|
|
|
|
Parameter 2 boolean. if true underscores are allowed in aliases |
36
|
|
|
|
|
|
|
if false, they are eliminated |
37
|
|
|
|
|
|
|
|
38
|
|
|
|
|
|
|
Returns |
39
|
|
|
|
|
|
|
|
40
|
|
|
|
|
|
|
An alias, which is unique among all the previous aliases called during the life of |
41
|
|
|
|
|
|
|
the object. |
42
|
|
|
|
|
|
|
|
43
|
|
|
|
|
|
|
|
44
|
|
|
|
|
|
|
|
45
|
|
|
|
|
|
|
|
46
|
|
|
|
|
|
|
=head1 LIMITATIONS |
47
|
|
|
|
|
|
|
|
48
|
|
|
|
|
|
|
|
49
|
|
|
|
|
|
|
|
50
|
|
|
|
|
|
|
=head1 REFERENCES |
51
|
|
|
|
|
|
|
|
52
|
|
|
|
|
|
|
|
53
|
|
|
|
|
|
|
|
54
|
|
|
|
|
|
|
=head1 HISTORY |
55
|
|
|
|
|
|
|
|
56
|
|
|
|
|
|
|
This code is derived from the code used on www.interguru.com/mailconv.htm . The site |
57
|
|
|
|
|
|
|
has been up since 1996 ( but ldif was only included on 1997, when Netscape 3 started |
58
|
|
|
|
|
|
|
using it.) The site gets about 8000 unique visitors a month, many of whom make addressbook |
59
|
|
|
|
|
|
|
conversions. The code has been well tested. |
60
|
|
|
|
|
|
|
|
61
|
|
|
|
|
|
|
=head1 FUTURE DIRECTIONS |
62
|
|
|
|
|
|
|
|
63
|
|
|
|
|
|
|
|
64
|
|
|
|
|
|
|
|
65
|
|
|
|
|
|
|
|
66
|
|
|
|
|
|
|
=head1 BUGS |
67
|
|
|
|
|
|
|
|
68
|
|
|
|
|
|
|
=head1 CHANGES |
69
|
|
|
|
|
|
|
|
70
|
|
|
|
|
|
|
Original Version 2001-Sept-09 |
71
|
|
|
|
|
|
|
|
72
|
|
|
|
|
|
|
=head1 COPYRIGHT |
73
|
|
|
|
|
|
|
|
74
|
|
|
|
|
|
|
Copyright (c) 2001 Joe Davidson. All rights reserved. |
75
|
|
|
|
|
|
|
This program is free software; you can redistribute it |
76
|
|
|
|
|
|
|
and/or modify it under the terms of the Perl Artistic License |
77
|
|
|
|
|
|
|
(see http://www.perl.com/perl/misc/Artistic.html). or the |
78
|
|
|
|
|
|
|
GPL copyleft license ( http://www.gnu.org/copyleft/gpl.html) |
79
|
|
|
|
|
|
|
|
80
|
|
|
|
|
|
|
|
81
|
|
|
|
|
|
|
=head1 AUTHOR |
82
|
|
|
|
|
|
|
|
83
|
|
|
|
|
|
|
Mail::Addressbook::Convert was written by Joe Davidson in 2001. |
84
|
|
|
|
|
|
|
|
85
|
|
|
|
|
|
|
=cut |
86
|
|
|
|
|
|
|
|
87
|
|
|
|
|
|
|
|
88
|
|
|
|
|
|
|
|
89
|
|
|
|
|
|
|
package Mail::Addressbook::Convert::PersistentUtilities; |
90
|
|
|
|
|
|
|
|
91
|
|
|
|
|
|
|
# This class contain methods which need persistent values. |
92
|
|
|
|
|
|
|
|
93
|
1
|
|
|
1
|
|
5
|
use Carp; |
|
1
|
|
|
|
|
3
|
|
|
1
|
|
|
|
|
95
|
|
94
|
1
|
|
|
1
|
|
510
|
use Mail::Addressbook::Convert::Utilities; |
|
1
|
|
|
|
|
2
|
|
|
1
|
|
|
|
|
59
|
|
95
|
|
|
|
|
|
|
|
96
|
1
|
|
|
1
|
|
5
|
use strict; |
|
1
|
|
|
|
|
1
|
|
|
1
|
|
|
|
|
204
|
|
97
|
|
|
|
|
|
|
|
98
|
|
|
|
|
|
|
############################ |
99
|
|
|
|
|
|
|
|
100
|
|
|
|
|
|
|
sub new |
101
|
|
|
|
|
|
|
{ |
102
|
10
|
|
|
10
|
1
|
17
|
my $self=shift; |
103
|
10
|
|
|
|
|
14
|
my %usedAlias; |
104
|
10
|
|
|
|
|
70
|
return bless |
105
|
|
|
|
|
|
|
{ ADDNUM=> 100, |
106
|
|
|
|
|
|
|
USEDALIAS =>\%usedAlias |
107
|
|
|
|
|
|
|
}, $self; |
108
|
|
|
|
|
|
|
} |
109
|
|
|
|
|
|
|
|
110
|
|
|
|
|
|
|
|
111
|
|
|
|
|
|
|
##########################################################################3 |
112
|
|
|
|
|
|
|
sub makeAliasUnique |
113
|
|
|
|
|
|
|
{ |
114
|
|
|
|
|
|
|
|
115
|
|
|
|
|
|
|
|
116
|
73
|
|
|
73
|
1
|
111
|
my ($self,$inputAlias,$allowUnderscores) = @_; |
117
|
|
|
|
|
|
|
|
118
|
73
|
|
|
|
|
173
|
my $alias = &cleanalias($inputAlias,$allowUnderscores); |
119
|
73
|
100
|
|
|
|
225
|
if (substr ($alias, -1,1) =~ /\d/) # does alias end in a number |
120
|
|
|
|
|
|
|
{ |
121
|
12
|
|
|
|
|
20
|
$alias = $alias."a"; |
122
|
|
|
|
|
|
|
} |
123
|
73
|
100
|
|
|
|
173
|
if ($self->{USEDALIAS}{$alias}) |
124
|
|
|
|
|
|
|
{ |
125
|
7
|
|
|
|
|
10
|
my $addNum = $self->{ADDNUM}; |
126
|
7
|
|
|
|
|
13
|
$alias = $alias.$addNum; |
127
|
7
|
|
|
|
|
10
|
$self->{ADDNUM}++; |
128
|
|
|
|
|
|
|
} |
129
|
73
|
|
|
|
|
179
|
$self->{USEDALIAS}{$alias} = 1; |
130
|
73
|
|
|
|
|
193
|
return $alias; |
131
|
|
|
|
|
|
|
} |
132
|
|
|
|
|
|
|
|
133
|
|
|
|
|
|
|
##########################################################################3 |
134
|
|
|
|
|
|
|
|
135
|
|
|
|
|
|
|
return 1; |