| line |
stmt |
bran |
cond |
sub |
pod |
time |
code |
|
1
|
|
|
|
|
|
|
=head1 NAME |
|
2
|
|
|
|
|
|
|
|
|
3
|
|
|
|
|
|
|
Mail::Addressbook::Convert::Genr - base class for many email conversion classes |
|
4
|
|
|
|
|
|
|
|
|
5
|
|
|
|
|
|
|
=head1 SYNOPSIS |
|
6
|
|
|
|
|
|
|
|
|
7
|
|
|
|
|
|
|
This class is not meant to be called by the user. It is the base class for |
|
8
|
|
|
|
|
|
|
|
|
9
|
|
|
|
|
|
|
Juno.pm |
|
10
|
|
|
|
|
|
|
|
|
11
|
|
|
|
|
|
|
Spry.pm |
|
12
|
|
|
|
|
|
|
|
|
13
|
|
|
|
|
|
|
Csv.pm |
|
14
|
|
|
|
|
|
|
|
|
15
|
|
|
|
|
|
|
Tsv.pm |
|
16
|
|
|
|
|
|
|
|
|
17
|
|
|
|
|
|
|
Compuserve.pm |
|
18
|
|
|
|
|
|
|
|
|
19
|
|
|
|
|
|
|
These classes will convert csv (comma separated variables), tsv (tab separated variables), |
|
20
|
|
|
|
|
|
|
sprymail exports, juno address exports. |
|
21
|
|
|
|
|
|
|
|
|
22
|
|
|
|
|
|
|
=head1 REQUIRES |
|
23
|
|
|
|
|
|
|
|
|
24
|
|
|
|
|
|
|
Perl, version 5.001 or higher |
|
25
|
|
|
|
|
|
|
|
|
26
|
|
|
|
|
|
|
Carp |
|
27
|
|
|
|
|
|
|
|
|
28
|
|
|
|
|
|
|
=head1 DESCRIPTION |
|
29
|
|
|
|
|
|
|
|
|
30
|
|
|
|
|
|
|
This is a base class designed for other modules in this distribution. |
|
31
|
|
|
|
|
|
|
|
|
32
|
|
|
|
|
|
|
=head1 DEFINITIONS |
|
33
|
|
|
|
|
|
|
|
|
34
|
|
|
|
|
|
|
Standard Intermediate Format(STF) : |
|
35
|
|
|
|
|
|
|
|
|
36
|
|
|
|
|
|
|
The addressbook format that is used as an intermediate |
|
37
|
|
|
|
|
|
|
between conversions. It is rfc822 compliant and can |
|
38
|
|
|
|
|
|
|
be used directly as a Eudora addressbook. Do not use |
|
39
|
|
|
|
|
|
|
a Eudora addressbook as an STF. Some versions of |
|
40
|
|
|
|
|
|
|
Eudora use a format, that while RFC822 compliant, will |
|
41
|
|
|
|
|
|
|
not work as an STF. Run the Eudora addressbook |
|
42
|
|
|
|
|
|
|
through $Eudora->scan() |
|
43
|
|
|
|
|
|
|
|
|
44
|
|
|
|
|
|
|
|
|
45
|
|
|
|
|
|
|
=head1 METHODS |
|
46
|
|
|
|
|
|
|
|
|
47
|
|
|
|
|
|
|
=head2 new |
|
48
|
|
|
|
|
|
|
|
|
49
|
|
|
|
|
|
|
no arguments needed. |
|
50
|
|
|
|
|
|
|
|
|
51
|
|
|
|
|
|
|
=head2 scan |
|
52
|
|
|
|
|
|
|
|
|
53
|
|
|
|
|
|
|
Input : a reference to an array containing input data. |
|
54
|
|
|
|
|
|
|
|
|
55
|
|
|
|
|
|
|
Returns: a reference to a STF ( see above). |
|
56
|
|
|
|
|
|
|
|
|
57
|
|
|
|
|
|
|
=head2 output |
|
58
|
|
|
|
|
|
|
|
|
59
|
|
|
|
|
|
|
Input: a reference to a STF ( see above). |
|
60
|
|
|
|
|
|
|
Returns : a reference to an array containing the output file. |
|
61
|
|
|
|
|
|
|
|
|
62
|
|
|
|
|
|
|
=head2 setfileFormat |
|
63
|
|
|
|
|
|
|
|
|
64
|
|
|
|
|
|
|
Sets the file format must be called before calling scan or output. |
|
65
|
|
|
|
|
|
|
Input, |
|
66
|
|
|
|
|
|
|
must be one of following "csv","tsv","spry","compuserve" before calling scan |
|
67
|
|
|
|
|
|
|
must be one of following "csv","tsv" before calling scan |
|
68
|
|
|
|
|
|
|
|
|
69
|
|
|
|
|
|
|
|
|
70
|
|
|
|
|
|
|
|
|
71
|
|
|
|
|
|
|
=head1 LIMITATIONS |
|
72
|
|
|
|
|
|
|
|
|
73
|
|
|
|
|
|
|
This only converts email address, aliases, and mailing lists. Phone numbers, |
|
74
|
|
|
|
|
|
|
postal addresses and other such data are not converted. |
|
75
|
|
|
|
|
|
|
|
|
76
|
|
|
|
|
|
|
|
|
77
|
|
|
|
|
|
|
|
|
78
|
|
|
|
|
|
|
=head1 REFERENCES |
|
79
|
|
|
|
|
|
|
|
|
80
|
|
|
|
|
|
|
|
|
81
|
|
|
|
|
|
|
|
|
82
|
|
|
|
|
|
|
|
|
83
|
|
|
|
|
|
|
=head1 HISTORY |
|
84
|
|
|
|
|
|
|
|
|
85
|
|
|
|
|
|
|
This code is derived from the code used on www.interguru.com/mailconv.htm . The site |
|
86
|
|
|
|
|
|
|
has been up since 1996 ( but ldif was only included on 1997, when Netscape 3 started |
|
87
|
|
|
|
|
|
|
using it.) The site gets about 8000 unique visitors a month, many of whom make addressbook |
|
88
|
|
|
|
|
|
|
conversions. The code has been well tested. |
|
89
|
|
|
|
|
|
|
|
|
90
|
|
|
|
|
|
|
=head1 FUTURE DIRECTIONS |
|
91
|
|
|
|
|
|
|
|
|
92
|
|
|
|
|
|
|
|
|
93
|
|
|
|
|
|
|
|
|
94
|
|
|
|
|
|
|
|
|
95
|
|
|
|
|
|
|
=head1 BUGS |
|
96
|
|
|
|
|
|
|
|
|
97
|
|
|
|
|
|
|
=head1 CHANGES |
|
98
|
|
|
|
|
|
|
|
|
99
|
|
|
|
|
|
|
Original Version 2001-Sept-09 |
|
100
|
|
|
|
|
|
|
|
|
101
|
|
|
|
|
|
|
=head1 COPYRIGHT |
|
102
|
|
|
|
|
|
|
|
|
103
|
|
|
|
|
|
|
Copyright (c) 2001 Joe Davidson. All rights reserved. |
|
104
|
|
|
|
|
|
|
This program is free software; you can redistribute it |
|
105
|
|
|
|
|
|
|
and/or modify it under the terms of the Perl Artistic License |
|
106
|
|
|
|
|
|
|
(see http://www.perl.com/perl/misc/Artistic.html). or the |
|
107
|
|
|
|
|
|
|
GPL copyleft license ( http://www.gnu.org/copyleft/gpl.html) |
|
108
|
|
|
|
|
|
|
|
|
109
|
|
|
|
|
|
|
|
|
110
|
|
|
|
|
|
|
=head1 AUTHOR |
|
111
|
|
|
|
|
|
|
|
|
112
|
|
|
|
|
|
|
Mail::Addressbook::Convert was written by Joe Davidson in 2001. |
|
113
|
|
|
|
|
|
|
|
|
114
|
|
|
|
|
|
|
=cut |
|
115
|
|
|
|
|
|
|
|
|
116
|
|
|
|
|
|
|
#------------------------------------------------------------------------------ |
|
117
|
|
|
|
|
|
|
|
|
118
|
1
|
|
|
1
|
|
5
|
use strict; |
|
|
1
|
|
|
|
|
3
|
|
|
|
1
|
|
|
|
|
60
|
|
|
119
|
|
|
|
|
|
|
|
|
120
|
|
|
|
|
|
|
|
|
121
|
|
|
|
|
|
|
package Mail::Addressbook::Convert::Genr; |
|
122
|
|
|
|
|
|
|
|
|
123
|
1
|
|
|
1
|
|
7
|
use Carp qw(croak confess) ; |
|
|
1
|
|
|
|
|
1
|
|
|
|
1
|
|
|
|
|
76
|
|
|
124
|
|
|
|
|
|
|
|
|
125
|
|
|
|
|
|
|
|
|
126
|
1
|
|
|
1
|
|
7
|
use Mail::Addressbook::Convert::Eudora; |
|
|
1
|
|
|
|
|
2
|
|
|
|
1
|
|
|
|
|
20
|
|
|
127
|
1
|
|
|
1
|
|
5
|
use Mail::Addressbook::Convert::Utilities; |
|
|
1
|
|
|
|
|
2
|
|
|
|
1
|
|
|
|
|
60
|
|
|
128
|
1
|
|
|
1
|
|
5
|
use Mail::Addressbook::Convert::PersistentUtilities; |
|
|
1
|
|
|
|
|
2
|
|
|
|
1
|
|
|
|
|
31
|
|
|
129
|
1
|
|
|
1
|
|
5
|
use Mail::Addressbook::Convert::Pine; |
|
|
1
|
|
|
|
|
2
|
|
|
|
1
|
|
|
|
|
21
|
|
|
130
|
1
|
|
|
1
|
|
37
|
use 5.001; |
|
|
1
|
|
|
|
|
3
|
|
|
|
1
|
|
|
|
|
2056
|
|
|
131
|
|
|
|
|
|
|
|
|
132
|
|
|
|
|
|
|
###################################################################### |
|
133
|
|
|
|
|
|
|
|
|
134
|
|
|
|
|
|
|
sub new { |
|
135
|
3
|
|
|
3
|
1
|
1315
|
bless { |
|
136
|
|
|
|
|
|
|
separator => "", |
|
137
|
|
|
|
|
|
|
fileFormat => "", |
|
138
|
|
|
|
|
|
|
} |
|
139
|
|
|
|
|
|
|
,shift; |
|
140
|
|
|
|
|
|
|
|
|
141
|
|
|
|
|
|
|
|
|
142
|
|
|
|
|
|
|
} |
|
143
|
|
|
|
|
|
|
|
|
144
|
|
|
|
|
|
|
###################################################################### |
|
145
|
|
|
|
|
|
|
|
|
146
|
|
|
|
|
|
|
sub setfileFormat |
|
147
|
|
|
|
|
|
|
{ |
|
148
|
5
|
|
|
5
|
1
|
10
|
my $Genr = shift; |
|
149
|
5
|
|
|
|
|
29
|
$Genr->{fileFormat} = shift; |
|
150
|
|
|
|
|
|
|
} |
|
151
|
|
|
|
|
|
|
|
|
152
|
|
|
|
|
|
|
|
|
153
|
|
|
|
|
|
|
|
|
154
|
|
|
|
|
|
|
|
|
155
|
|
|
|
|
|
|
|
|
156
|
|
|
|
|
|
|
|
|
157
|
|
|
|
|
|
|
|
|
158
|
|
|
|
|
|
|
|
|
159
|
|
|
|
|
|
|
###################################################################### |
|
160
|
|
|
|
|
|
|
sub scan { |
|
161
|
|
|
|
|
|
|
|
|
162
|
3
|
|
|
3
|
1
|
6
|
my $Genr = shift; |
|
163
|
3
|
|
|
|
|
7
|
my $fileFormat= $Genr->{fileFormat}; |
|
164
|
|
|
|
|
|
|
|
|
165
|
3
|
|
|
|
|
24
|
my $perUtil = new Mail::Addressbook::Convert::PersistentUtilities(); |
|
166
|
|
|
|
|
|
|
|
|
167
|
|
|
|
|
|
|
|
|
168
|
3
|
|
|
|
|
7
|
my $inputParm = shift; # reference to input data as an array reference |
|
169
|
|
|
|
|
|
|
|
|
170
|
|
|
|
|
|
|
|
|
171
|
3
|
|
|
|
|
12
|
my $raGenrArray= getInput($inputParm); |
|
172
|
|
|
|
|
|
|
|
|
173
|
|
|
|
|
|
|
|
|
174
|
|
|
|
|
|
|
|
|
175
|
3
|
|
|
|
|
15
|
my @file= @$raGenrArray; |
|
176
|
|
|
|
|
|
|
|
|
177
|
|
|
|
|
|
|
|
|
178
|
3
|
50
|
|
|
|
9
|
unless ($fileFormat) {confess "file format not specified\n"}; |
|
|
0
|
|
|
|
|
0
|
|
|
179
|
|
|
|
|
|
|
|
|
180
|
3
|
50
|
|
|
|
15
|
if ($fileFormat !~ /^csv$|^tsv$|^spry$|^compuserve$/) |
|
|
0
|
|
|
|
|
0
|
|
|
181
|
|
|
|
|
|
|
{confess qq(\nFile format "$fileFormat" is not supported );} |
|
182
|
|
|
|
|
|
|
|
|
183
|
|
|
|
|
|
|
|
|
184
|
3
|
|
|
|
|
7
|
my (%listMember,@outputFile, @comment, @address, $totalAddress); |
|
185
|
0
|
|
|
|
|
0
|
my ($totalName , @firstName, @lastName); |
|
186
|
0
|
|
|
|
|
0
|
my ( $ai, @temp, $individualAliasNumber); |
|
187
|
0
|
|
|
|
|
0
|
my ($AAA, @a, $tempAlias, @b, $i, $j, %aliasList, @alias); |
|
188
|
0
|
|
|
|
|
0
|
my ($tempAlias1, %existingListAlias); |
|
189
|
|
|
|
|
|
|
|
|
190
|
3
|
|
|
|
|
7
|
my $separator = "\t"; |
|
191
|
3
|
100
|
|
|
|
10
|
$separator = "," if ($fileFormat eq "csv"); |
|
192
|
|
|
|
|
|
|
|
|
193
|
|
|
|
|
|
|
|
|
194
|
3
|
|
|
|
|
9
|
foreach my $i (0..$#file) |
|
195
|
|
|
|
|
|
|
{ #Block 1 |
|
196
|
|
|
|
|
|
|
|
|
197
|
27
|
|
|
|
|
39
|
chomp $file[$i]; |
|
198
|
27
|
100
|
|
|
|
53
|
next unless $file[$i]; |
|
199
|
23
|
|
|
|
|
40
|
$file[$i] =~ s/\r|\015//g; |
|
200
|
|
|
|
|
|
|
##### for Spry Mail ######## |
|
201
|
23
|
50
|
|
|
|
45
|
if ($fileFormat eq "spry") |
|
202
|
|
|
|
|
|
|
{ |
|
203
|
0
|
|
|
|
|
0
|
my ($a1,$b1) = split(":",$file[$i]); |
|
204
|
0
|
|
|
|
|
0
|
$file[$i] = $b1."\t".$a1; |
|
205
|
0
|
|
|
|
|
0
|
$file[$i] =~s/,/SPRYCOMMA/g; |
|
206
|
|
|
|
|
|
|
#print "JHD SPRY file = $file[$i]\n"; |
|
207
|
0
|
|
|
|
|
0
|
undef $ai; |
|
208
|
0
|
|
|
|
|
0
|
undef $b1; |
|
209
|
|
|
|
|
|
|
} |
|
210
|
|
|
|
|
|
|
###### end SpryMail ########################## |
|
211
|
|
|
|
|
|
|
##### all formats below ################## |
|
212
|
|
|
|
|
|
|
|
|
213
|
23
|
|
|
|
|
122
|
@temp = split($separator,$file[$i]); |
|
214
|
23
|
|
|
|
|
42
|
foreach (@temp) {s/^\s*"|"\s*$//;} # get rid of leading and trailing quotes. |
|
|
89
|
|
|
|
|
299
|
|
|
215
|
23
|
|
|
|
|
29
|
{ local $^W; # turn off warnings |
|
|
23
|
|
|
|
|
48
|
|
|
216
|
23
|
|
|
|
|
99
|
($address[$individualAliasNumber],$firstName[$individualAliasNumber], |
|
217
|
|
|
|
|
|
|
$lastName[$individualAliasNumber],$tempAlias, |
|
218
|
|
|
|
|
|
|
$comment[$individualAliasNumber]) |
|
219
|
|
|
|
|
|
|
= @temp[0..4]; |
|
220
|
|
|
|
|
|
|
} |
|
221
|
|
|
|
|
|
|
|
|
222
|
|
|
|
|
|
|
|
|
223
|
|
|
|
|
|
|
##### start section for CompuServe ########################## |
|
224
|
23
|
50
|
|
|
|
54
|
if ($fileFormat eq "compuserve") |
|
225
|
|
|
|
|
|
|
{ |
|
226
|
0
|
|
|
|
|
0
|
$address[$individualAliasNumber] =~ s/INTERNET://g; |
|
227
|
0
|
0
|
0
|
|
|
0
|
if ($address[$individualAliasNumber] =~ /\,/ and |
|
228
|
|
|
|
|
|
|
$address[$individualAliasNumber] !~/@/) |
|
229
|
|
|
|
|
|
|
{ |
|
230
|
0
|
|
|
|
|
0
|
$address[$individualAliasNumber] =~ s/\"//g; |
|
231
|
0
|
|
|
|
|
0
|
$address[$individualAliasNumber] =~ s/\,/\./; |
|
232
|
0
|
|
|
|
|
0
|
$AAA = $address[$individualAliasNumber]; |
|
233
|
0
|
|
|
|
|
0
|
$address[$individualAliasNumber] = |
|
234
|
|
|
|
|
|
|
$AAA.'@compuserve.com'; |
|
235
|
0
|
|
|
|
|
0
|
$tempAlias = $firstName[$individualAliasNumber]. |
|
236
|
|
|
|
|
|
|
$lastName[$individualAliasNumber]; |
|
237
|
0
|
0
|
|
|
|
0
|
unless ($tempAlias) {$tempAlias = $AAA;} |
|
|
0
|
|
|
|
|
0
|
|
|
238
|
|
|
|
|
|
|
} |
|
239
|
|
|
|
|
|
|
} |
|
240
|
|
|
|
|
|
|
######### end Compuserve Section |
|
241
|
23
|
100
|
|
|
|
46
|
unless ($tempAlias) |
|
242
|
|
|
|
|
|
|
{ |
|
243
|
|
|
|
|
|
|
{ |
|
244
|
21
|
|
|
|
|
20
|
local $^W; |
|
|
21
|
|
|
|
|
34
|
|
|
245
|
21
|
|
|
|
|
75
|
@a = split('@',$address[$individualAliasNumber]); |
|
246
|
|
|
|
|
|
|
} |
|
247
|
21
|
|
|
|
|
29
|
$tempAlias = $a[0]; |
|
248
|
21
|
50
|
|
|
|
47
|
if ($tempAlias =~ /\"/ ) |
|
249
|
|
|
|
|
|
|
{ |
|
250
|
0
|
|
|
|
|
0
|
@a = split ("\"", $tempAlias); |
|
251
|
0
|
|
|
|
|
0
|
$tempAlias = $a[$#a]; |
|
252
|
0
|
|
|
|
|
0
|
@a = split ("\"",$address[$individualAliasNumber]); |
|
253
|
0
|
|
|
|
|
0
|
$address[$individualAliasNumber] = $a[$#a]; |
|
254
|
|
|
|
|
|
|
} |
|
255
|
21
|
50
|
|
|
|
44
|
if ($tempAlias =~ /\>/ ) |
|
256
|
|
|
|
|
|
|
{ |
|
257
|
0
|
|
|
|
|
0
|
@a = split ("<", $tempAlias); |
|
258
|
0
|
|
|
|
|
0
|
$tempAlias = $a[1]; |
|
259
|
0
|
|
|
|
|
0
|
@b = split ("\<",$address[$individualAliasNumber]); |
|
260
|
0
|
|
|
|
|
0
|
$address[$individualAliasNumber] = $b[1]; |
|
261
|
0
|
|
|
|
|
0
|
$address[$individualAliasNumber] =~ s/\>+//; |
|
262
|
0
|
|
|
|
|
0
|
$address[$individualAliasNumber] =~ s/\<+//; |
|
263
|
0
|
0
|
0
|
|
|
0
|
unless ($firstName[$individualAliasNumber] |
|
264
|
|
|
|
|
|
|
or $lastName[$individualAliasNumber]) |
|
265
|
|
|
|
|
|
|
{ |
|
266
|
0
|
|
|
|
|
0
|
$firstName[$individualAliasNumber] = $b[0]; |
|
267
|
0
|
|
|
|
|
0
|
$firstName[$individualAliasNumber] =~ s/\"//g; |
|
268
|
|
|
|
|
|
|
} |
|
269
|
|
|
|
|
|
|
} |
|
270
|
|
|
|
|
|
|
} |
|
271
|
23
|
|
|
|
|
68
|
$tempAlias = $perUtil->makeAliasUnique($tempAlias); |
|
272
|
23
|
|
|
|
|
52
|
$aliasList{$tempAlias} = 1; |
|
273
|
23
|
|
|
|
|
25
|
{local $^W; |
|
|
23
|
|
|
|
|
39
|
|
|
274
|
23
|
|
|
|
|
51
|
$alias[$individualAliasNumber] = $tempAlias ; |
|
275
|
|
|
|
|
|
|
} |
|
276
|
|
|
|
|
|
|
|
|
277
|
23
|
100
|
|
|
|
41
|
if ($temp[5]) |
|
278
|
|
|
|
|
|
|
{ |
|
279
|
6
|
|
|
|
|
8
|
$j = 5; |
|
280
|
6
|
|
|
|
|
13
|
while ($temp[$j] ) |
|
281
|
|
|
|
|
|
|
{ |
|
282
|
10
|
100
|
|
|
|
21
|
if($existingListAlias{$temp[$j]}) |
|
283
|
|
|
|
|
|
|
{ |
|
284
|
4
|
|
|
|
|
7
|
$tempAlias1 = $existingListAlias{$temp[$j]}; |
|
285
|
|
|
|
|
|
|
} |
|
286
|
|
|
|
|
|
|
else |
|
287
|
|
|
|
|
|
|
{ |
|
288
|
6
|
|
|
|
|
20
|
$tempAlias1 = $perUtil->makeAliasUnique($temp[$j]); |
|
289
|
6
|
|
|
|
|
16
|
$existingListAlias{$temp[$j]} = $tempAlias1; |
|
290
|
|
|
|
|
|
|
} |
|
291
|
10
|
|
|
|
|
11
|
{local $^W; |
|
|
10
|
|
|
|
|
21
|
|
|
292
|
10
|
|
|
|
|
32
|
$listMember{$tempAlias1} = |
|
293
|
|
|
|
|
|
|
$listMember{$tempAlias1}.$alias[$individualAliasNumber].","; |
|
294
|
|
|
|
|
|
|
} |
|
295
|
|
|
|
|
|
|
|
|
296
|
10
|
|
|
|
|
23
|
$j++ |
|
297
|
|
|
|
|
|
|
} |
|
298
|
|
|
|
|
|
|
} |
|
299
|
|
|
|
|
|
|
else |
|
300
|
|
|
|
|
|
|
{ |
|
301
|
17
|
|
|
|
|
28
|
local $^W; |
|
302
|
17
|
|
|
|
|
52
|
$listMember{'notonanotherlist'} = |
|
303
|
|
|
|
|
|
|
$listMember{'notonanotherlist'}.$alias[$individualAliasNumber].","; |
|
304
|
|
|
|
|
|
|
} |
|
305
|
23
|
|
|
|
|
44
|
undef (@temp); |
|
306
|
23
|
|
|
|
|
26
|
{ local $^W; |
|
|
23
|
|
|
|
|
37
|
|
|
307
|
23
|
|
|
|
|
66
|
$listMember{'everybody'} = |
|
308
|
|
|
|
|
|
|
$listMember{'everybody'}.$alias[$individualAliasNumber].","; |
|
309
|
|
|
|
|
|
|
} |
|
310
|
|
|
|
|
|
|
|
|
311
|
23
|
|
|
|
|
33
|
$individualAliasNumber++; |
|
312
|
|
|
|
|
|
|
} #End Block 1 |
|
313
|
|
|
|
|
|
|
|
|
314
|
3
|
|
|
|
|
8
|
foreach $i (0 .. $#address) |
|
315
|
|
|
|
|
|
|
{ |
|
316
|
23
|
100
|
66
|
|
|
67
|
if ($firstName[$i] or $lastName[$i]) |
|
|
19
|
|
|
|
|
30
|
|
|
317
|
|
|
|
|
|
|
{local $^W; |
|
318
|
19
|
|
|
|
|
37
|
$totalName = $firstName[$i]." ".$lastName[$i]; |
|
319
|
19
|
|
|
|
|
45
|
$totalAddress = qq{"$totalName"<$address[$i]>}; |
|
320
|
|
|
|
|
|
|
} |
|
321
|
|
|
|
|
|
|
else |
|
322
|
|
|
|
|
|
|
{ |
|
323
|
4
|
|
|
|
|
7
|
$totalAddress = $address[$i]; |
|
324
|
|
|
|
|
|
|
} |
|
325
|
|
|
|
|
|
|
|
|
326
|
23
|
|
|
|
|
56
|
push (@outputFile, "alias ".$alias[$i]." ". |
|
327
|
|
|
|
|
|
|
$totalAddress."\n"); |
|
328
|
23
|
100
|
|
|
|
44
|
if ($comment[$i]) |
|
329
|
|
|
|
|
|
|
{ |
|
330
|
10
|
|
|
|
|
23
|
push (@outputFile, "note ".$alias[$i]." ". |
|
331
|
|
|
|
|
|
|
$comment[$i]."\n"); |
|
332
|
|
|
|
|
|
|
} |
|
333
|
|
|
|
|
|
|
} |
|
334
|
|
|
|
|
|
|
|
|
335
|
|
|
|
|
|
|
|
|
336
|
3
|
|
|
|
|
12
|
foreach my $listAlias (keys %listMember) |
|
337
|
|
|
|
|
|
|
{ |
|
338
|
12
|
|
|
|
|
17
|
chop $listMember{$listAlias}; # get rid of trailing comma |
|
339
|
12
|
|
|
|
|
30
|
push (@outputFile, "alias ".$listAlias." ". |
|
340
|
|
|
|
|
|
|
$listMember{$listAlias}."\n"); |
|
341
|
|
|
|
|
|
|
} |
|
342
|
|
|
|
|
|
|
|
|
343
|
|
|
|
|
|
|
|
|
344
|
|
|
|
|
|
|
# run $Eudora->scan to resolve list addresses into aliases |
|
345
|
|
|
|
|
|
|
|
|
346
|
3
|
|
|
|
|
60
|
my $Eudo = new Mail::Addressbook::Convert::Eudora(); |
|
347
|
3
|
|
|
|
|
12
|
my $raOuputFile = $Eudo->scan(\@outputFile); |
|
348
|
|
|
|
|
|
|
|
|
349
|
3
|
|
|
|
|
56
|
return $raOuputFile; |
|
350
|
|
|
|
|
|
|
} |
|
351
|
|
|
|
|
|
|
|
|
352
|
|
|
|
|
|
|
|
|
353
|
|
|
|
|
|
|
########################### sub output ####################### |
|
354
|
|
|
|
|
|
|
sub output |
|
355
|
|
|
|
|
|
|
|
|
356
|
|
|
|
|
|
|
{ |
|
357
|
|
|
|
|
|
|
|
|
358
|
2
|
|
|
2
|
1
|
3
|
my (@outputFile); |
|
359
|
|
|
|
|
|
|
|
|
360
|
2
|
|
|
|
|
5
|
my $Genr = shift; |
|
361
|
2
|
|
|
|
|
3
|
my $raInputArray = shift; # reference to input Input data as an array |
|
362
|
2
|
|
|
|
|
7
|
my $fileFormat= $Genr->{fileFormat}; |
|
363
|
|
|
|
|
|
|
|
|
364
|
2
|
50
|
66
|
|
|
31
|
unless ($fileFormat eq 'csv' or $fileFormat eq 'tsv') |
|
|
0
|
|
|
|
|
0
|
|
|
365
|
|
|
|
|
|
|
{confess "\n Ascii output file format must be specified as 'csv' or 'tsv'\n\n";} |
|
366
|
|
|
|
|
|
|
|
|
367
|
2
|
|
|
|
|
22
|
my $Pine = new Mail::Addressbook::Convert::Pine(); |
|
368
|
|
|
|
|
|
|
|
|
369
|
2
|
|
|
|
|
8
|
my $raPineArray = $Pine->output($raInputArray); |
|
370
|
|
|
|
|
|
|
|
|
371
|
|
|
|
|
|
|
#print "\njhd4455 PINE \n@$raPineArray\n\n"; |
|
372
|
|
|
|
|
|
|
|
|
373
|
2
|
|
|
|
|
5
|
my $sep = "\t"; |
|
374
|
2
|
100
|
|
|
|
8
|
$sep = ',' if $fileFormat eq 'csv'; |
|
375
|
|
|
|
|
|
|
|
|
376
|
2
|
|
|
|
|
8
|
foreach $_ (@$raPineArray) |
|
377
|
|
|
|
|
|
|
{ |
|
378
|
|
|
|
|
|
|
#print "JHD53 $_\n"; |
|
379
|
24
|
50
|
|
|
|
69
|
next unless /\t/; |
|
380
|
24
|
|
|
|
|
41
|
chomp; |
|
381
|
24
|
|
|
|
|
85
|
my ($alias,$wholeName,$address,$junk,$comment) = |
|
382
|
|
|
|
|
|
|
split('\t'); |
|
383
|
24
|
|
|
|
|
55
|
my ($name1,$name2) = split(',',$wholeName); |
|
384
|
24
|
|
|
|
|
80
|
$address =~ s/\(|\)//g; |
|
385
|
24
|
100
|
|
|
|
66
|
$address = &addquotes($address)if $address ; |
|
386
|
24
|
100
|
|
|
|
64
|
$name1 = &addquotes($name1) if $name1 ; |
|
387
|
24
|
100
|
|
|
|
53
|
$name2 = &addquotes($name2) if $name2; |
|
388
|
24
|
100
|
|
|
|
53
|
$comment = &addquotes($comment) if $comment ; |
|
389
|
24
|
|
|
|
|
41
|
$alias = &addquotes($alias) ; |
|
390
|
24
|
|
|
|
|
31
|
my $holdLine; |
|
391
|
24
|
|
|
|
|
28
|
{ local $^W; #turn off warnings |
|
|
24
|
|
|
|
|
49
|
|
|
392
|
24
|
|
|
|
|
77
|
$holdLine = join($sep, $address,$name1,$name2,$alias,$comment); |
|
393
|
|
|
|
|
|
|
} |
|
394
|
|
|
|
|
|
|
|
|
395
|
24
|
100
|
|
|
|
205
|
push (@outputFile, $holdLine."\n") if $holdLine =~ /[^"$sep]/; |
|
396
|
|
|
|
|
|
|
} |
|
397
|
2
|
|
|
|
|
16
|
return \@outputFile; |
|
398
|
|
|
|
|
|
|
} |
|
399
|
|
|
|
|
|
|
|
|
400
|
|
|
|
|
|
|
sub addquotes |
|
401
|
|
|
|
|
|
|
{ |
|
402
|
84
|
|
|
84
|
0
|
110
|
my $input = shift; |
|
403
|
84
|
|
|
|
|
105
|
$input =~ s/"//g; |
|
404
|
84
|
|
|
|
|
177
|
return '"'.$input.'"'; |
|
405
|
|
|
|
|
|
|
} |
|
406
|
|
|
|
|
|
|
|
|
407
|
|
|
|
|
|
|
|
|
408
|
|
|
|
|
|
|
|
|
409
|
|
|
|
|
|
|
########################### end sub output ####################### |
|
410
|
|
|
|
|
|
|
1; |