| 1 | =head1 NAME | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 2 | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 3 | Mail::Addressbook::Convert::Eudora - convert to and from Eudora addressbooks | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 4 | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 5 | =head1 SYNOPSIS | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 6 | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 7 | use strict; | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 8 | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 9 | use Eudora; | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 10 | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 11 | my $Eudora = new Eudora(); | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 12 | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 13 | my $EudoraInFile ="eudoraSample.txt"; # name of the file containing the Eudora data | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 14 | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 15 | # Convert Eudora to Standard Intermediate format | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 16 | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 17 | # see documentation for details on format. | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 18 | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 19 | my $raIntermediate = $Eudora->scan(\$EudoraInFile); | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 20 | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 21 | # This will also work | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 22 | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 23 | #my @EudoraInArray = @arrayContainingTheEudoraData; | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 24 | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 25 | #my $raIntermediate = $Eudora->scan(\@EudoraInArray); | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 26 | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 27 | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 28 | # Convert back to Eudora | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 29 | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 30 | my $raEudorafOut = $Eudora->output($raIntermediate); | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 31 | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 32 | print join "", @$raIntermediate; | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 33 | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 34 | print "\n\n\n\n"; | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 35 | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 36 | print join "", @$raEudorafOut | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 37 | ; | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 38 | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 39 | =head1 REQUIRES | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 40 | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 41 | Perl, version 5.001 or higher | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 42 | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 43 | Carp | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 44 | Text::ParseWords | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 45 | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 46 | =head1 DESCRIPTION | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 47 | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 48 | This module is meant to be used as part of the Mail::Addressbook::Convert distribution. | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 49 | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 50 | It can convert a Eudoraaddressbook to a Standard Intermediate format(STF) and a STF to Eudora | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 51 | As part of the larger distribution, it will allow conversion between Eudora and many other | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 52 | formats. | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 53 | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 54 | To use to convert between Eudora and Ldif as an example, you would do the following | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 55 | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 56 | use Mail::Addressbook::Convert::Ldif; | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 57 | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 58 | use Mail::Addressbook::Convert::Eudora; | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 59 | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 60 | my $Ldif = new Mail::Addressbook::Convert::Ldif(); | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 61 | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 62 | my $Eudora = new Mail::Addressbook::Convert::Eudora(); | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 63 | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 64 | my $EudoraInFile ="eudoraSample.txt"; # name of the file containing the Eudora data | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 65 | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 66 | my $raIntermediate = $Ldif->scan(\$EudoraInFile); | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 67 | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 68 | my $raLdif = $Ldif->output($raIntermediate); # reference to an array containing a Ldif addressbook | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 69 | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 70 | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 71 | =head1 DEFINITIONS | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 72 | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 73 | Standard Intermediate Format(STF) : | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 74 | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 75 | The addressbook format that is used as an intermediate | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 76 | between conversions. It is rfc822 compliant and can | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 77 | be used directly as a Eudora addressbook. Do not use | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 78 | a Eudora addressbook as an STF. Some versions of | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 79 | Eudora use a format, that while RFC822 compliant, will | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 80 | not work as an STF. Run the Eudora addressbook | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 81 | through $Eudora->scan() | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 82 | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 83 | Eudora addressbook: | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 84 | A Eudora addressbook. The input Eudora address file is | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 85 | "nndbase.txt" in the Eudora directory. for Windows users | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 86 | "Eudora Nicknames" in the System Folder:Eudora Folder for Mac users | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 87 | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 88 | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 89 | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 90 | =head1 METHODS | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 91 | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 92 | =head2 new | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 93 | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 94 | no arguments needed. | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 95 | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 96 | =head2 scan | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 97 | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 98 | Input : a reference to an array containing a Eudora addressbook | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 99 | or a reference to a scalar containing | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 100 | the file name with the Eudora Addressbook. | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 101 | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 102 | Returns: a reference to a STF ( see above). | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 103 | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 104 | =head2 output | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 105 | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 106 | Input: a reference to a STF ( see above). | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 107 | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 108 | Returns : a reference to an array containing a Eudora addressbook. | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 109 | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 110 | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 111 | =head1 LIMITATIONS | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 112 | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 113 | This only converts email address, aliases, and mailing lists. Phone numbers, | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 114 | postal addresses and other such data are not converted. | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 115 | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 116 | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 117 | =head1 REFERENCES | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 118 | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 119 | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 120 | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 121 | I derived the format by visually inspecting examples, not by reading a document. | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 122 | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 123 | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 124 | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 125 | =head1 HISTORY | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 126 | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 127 | This code is derived from the code used on www.interguru.com/mailconv.htm . The site | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 128 | has been up since 1996 The site gets about 8000 unique visitors a month, | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 129 | many of whom make addressbook conversions. The code has been well tested. | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 130 | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 131 | =head1 FUTURE DIRECTIONS | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 132 | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 133 | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 134 | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 135 | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 136 | =head1 SEE ALSO | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 137 | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 138 | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 139 | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 140 | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 141 | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 142 | =head1 BUGS | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 143 | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 144 | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 145 | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 146 | =head1 CHANGES | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 147 | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 148 | Original Version 2001-Sept-09 | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 149 | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 150 | =head1 COPYRIGHT | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 151 | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 152 | Copyright (c) 2001 Joe Davidson. All rights reserved. | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 153 | This program is free software; you can redistribute it | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 154 | and/or modify it under the terms of the Perl Artistic License | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 155 | (see http://www.perl.com/perl/misc/Artistic.html). or the | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 156 | GPL copyleft license ( http://www.gnu.org/copyleft/gpl.html) | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 157 | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 158 | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 159 | =head1 AUTHOR | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 160 | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 161 | Mail::Addressbook::Convert was written by Joe Davidson <jdavidson@interguru.com> in 2001. | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 162 | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 163 | =cut | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 164 | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 165 | #------------------------------------------------------------------------------ | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 166 | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 167 | 1 | ▶ | use strict; | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
Subroutine
BEGIN: called CC=1 SCAR=0.0
| |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 168 | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 169 | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 170 | package Mail::Addressbook::Convert::Eudora; | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 171 | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 172 | 1 | ▶ | use Mail::Addressbook::Convert::Utilities; | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
Subroutine
BEGIN: called CC=1 SCAR=0.0
| |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 173 | 1 | ▶ | use Mail::Addressbook::Convert::PersistentUtilities; | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
Subroutine
BEGIN: called CC=1 SCAR=0.0
| |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 174 | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 175 | 1 | ▶ | use 5.001; | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
Subroutine
BEGIN: called CC=1 SCAR=0.0
| |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 176 | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 177 | 5 | ▶ | sub new { | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
Subroutine
new: called CC=1 SCAR=0.0
Pod
documented
| |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 178 | 5 | bless {},shift; | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 179 | } | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 180 | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 181 | ###################################################################### | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 182 | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 183 | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 184 | 5 | ▶ | sub scan { | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
Subroutine
scan: called CC=23 SCAR=33.1
Pod
documented
| |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 185 | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 186 | 5 | my $Eudora = shift; | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 187 | 5 | my $inputParm = shift; # reference to input Eudora data as an array or reference to a scalar | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 188 | # containing the name of a file containing the Eudora Addressbook. | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 189 | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 190 | 5 | my $perUtil = new Mail::Addressbook::Convert::PersistentUtilities(); | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 191 | 5 | my $raEudoraArray= getInput($inputParm); | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 192 | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 193 | 5 | my (@outputFile, %noteLine, $outLine, %listEntry, %name, $alias); | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 194 | 5 | my ( $type, @rest, $rest, %address, %aliasOf, %newAlias, $nm, @tmp); | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 195 | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 196 | 1 | ▶ | use Text::ParseWords; | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
Subroutine
BEGIN: called CC=1 SCAR=0.0
| |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 197 | 5 | my $individualIndex = 0; | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 198 | 5 | my $listIndex = 0; | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 199 | 5 | foreach (@$raEudoraArray) | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 200 | { | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 201 | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 202 | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 203 | 59 | s/\'//g; | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 204 | 59 | ▶ | if (tr/"/"/%2 !=0) # to prevent unterminated quotes | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 205 | # (which should not exist, but ocasionaly do) | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 206 | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 207 | # The garbled line will remain | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 208 | # garbled. | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 209 | { | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 210 | 0 | s/ / "/; | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 211 | } | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 212 | 59 | s/\s+</</; | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 213 | 59 | @tmp = split(" "); | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 214 | 59 | ▶ | if (@tmp > 3 and /</ and !/"/ and !/^note/) | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
Branch: 1 branch
Condition66%6/9
@tmp > 3 and /</ and not /"/ and not /^note/
@tmp > 3 and /</ and not /"/
@tmp > 3 and /</
MC/DC0%0/4
@tmp > 3 and /</ and not /"/ and not /^note/
@tmp > 3
/</
not /"/
not /^note/
Truth table60%3/5
A and B and not(C) and not(D)
A= @tmp > 3B= /</C= not /"/D= not /^note/
| |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 215 | { | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 216 | 0 | /alias\s+(.+)<(.+)>/; | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 217 | 0 | my $firstPart = $1; | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 218 | 0 | my $lastPart = $2; | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 219 | 0 | $firstPart =~ s/^\s+|\s+$//g; # trim leading and trailing spaces. | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 220 | 0 | my @hold22= split(" ", $firstPart); | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 221 | 0 | ▶ | if (@hold22 > 2) | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 222 | { | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 223 | 0 | my $aliasName= shift @hold22; | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 224 | 0 | my $givenName = join (" ", @hold22); | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 225 | 0 | $_ = qq(alias $aliasName "$givenName"<$lastPart>); | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 226 | } | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 227 | else | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 228 | { | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 229 | 0 | $_ = qq(alias "$firstPart"<$lastPart>); | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 230 | } | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 231 | } | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 232 | 59 | ▶ | if (/alias "/ and !/<|,/) | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
Branch: 1 branch
Condition66%2/3
/alias "/ and not /<|,/
MC/DC50%1/2
/alias "/ and not /<|,/
/alias "/
not /<|,/
Truth table66%2/3
A and not(B)
A= /alias "/B= not /<|,/
| |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 233 | { | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 234 | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 235 | 3 | ($type,$alias,@rest) = quotewords(" ",0,$_); | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 236 | 3 | my $userName = $alias; | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 237 | 3 | $alias =~ s/ /_/g; | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 238 | 3 | $_ = qq(alias $alias $userName<$rest[0]>); | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 239 | } | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 240 | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 241 | 59 | ($type,$alias,@rest) = quotewords(" ",0,$_); | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 242 | 59 | ▶ | if ($rest[1]) | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 243 | { | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 244 | 9 | $rest = join("_",@rest); | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 245 | } | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 246 | else | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 247 | { | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 248 | 50 | $rest = $rest[0]; | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 249 | } | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 250 | 59 | $alias =~ s/^\s+|\s+$//g; | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 251 | 59 | $alias =~ s/ //g; | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 252 | 59 | $rest =~ s/^\s+|\s+$//g; | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 253 | 59 | ▶ | if ($type =~ /note/) | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 254 | { | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 255 | 11 | $noteLine{$alias} = $_; | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 256 | } | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 257 | else | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 258 | { | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 259 | 48 | ▶ | if ($rest =~ /\,/) | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 260 | { | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 261 | 17 | $listEntry{$alias} = $rest; | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 262 | } | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 263 | else | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 264 | { | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 265 | 31 | ▶ | if ($rest =~ /\)$/) | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
Branch: 2 branches
| |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 266 | { | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 267 | #alias joan joan.olive@utoronto.ca (Joan Olive) | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 268 | 0 | ($address{$alias}, $name{$alias}) = | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 269 | split(/\(/,$rest); | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 270 | } | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 271 | elsif ($rest =~ /</) | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 272 | { | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 273 | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 274 | #alias jhd joe<jhd@intergur.com> | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 275 | #alias jhd <jhd@intergur.com> | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 276 | #alias jhd Joe Davidson<jdavidson@Interguru.com> | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 277 | 24 | ($name{$alias},$address{$alias}) = split(/\</,$rest); | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 278 | 24 | $address{$alias} =~ s/>//; | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 279 | $name{$alias} = (split(/@/,$address{$alias}))[0] | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 280 | 24 | ▶ | unless $name{$alias}; | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 281 | } | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 282 | else | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 283 | { | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 284 | 7 | $address{$alias} = $rest; | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 285 | 7 | $name{$alias} = (split(/@/,$address{$alias}))[0]; | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 286 | } | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 287 | } | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 288 | } | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 289 | } | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 290 | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 291 | #Examples | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 292 | 5 | foreach my $key (sort { lc($a) cmp lc($b)} ( (keys %name))) | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 293 | { | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 294 | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 295 | 31 | my $tempAlias = $perUtil->makeAliasUnique($key); | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 296 | 31 | $address{$key} =~ s/\s+|>\(|\)|<|\n|\r//g; | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 297 | 31 | $name{$key} =~ s/\)|\(|\n|\r|\"|^\s+|>|<|\s+$//g; | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 298 | 31 | $aliasOf{$address{$key}} = $tempAlias; | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 299 | 31 | $newAlias{key} = $tempAlias; | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 300 | 31 | $nm = $name{$key}; | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 301 | 31 | $nm =~ s/_/ /g; | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 302 | #CONTINUE HERE | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 303 | 31 | $outLine = qq(alias $key \"$nm\"<$address{$key}>\n); | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 304 | 31 | $outLine =~ s/>>/>/; | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 305 | 31 | $outLine =~ s/SPRYCOMMA/,/; | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 306 | 31 | ▶ | push ( @outputFile, $outLine) if ($address{$key}) ; | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 307 | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 308 | 31 | ▶ | push ( @outputFile, $noteLine{$key}) if $noteLine{$key}; | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 309 | } | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 310 | 5 | my @listMembers; | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 311 | 5 | foreach my $key (sort { lc($a) cmp lc($b)} (keys %listEntry)) | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 312 | { | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 313 | 17 | $listEntry{$key} =~ s/\)|\(|\n|\r|\"|^\s+|>|<|\s+$//g; | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 314 | 17 | @listMembers = split(/\,/,$listEntry{$key}); | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 315 | 17 | foreach my $k (0..$#listMembers) | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 316 | { | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 317 | $listMembers[$k] = $aliasOf{$listMembers[$k]} | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 318 | 66 | ▶ | if $aliasOf{$listMembers[$k]}; | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 319 | } | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 320 | 17 | $listEntry{$key} = join(',' , @listMembers ); | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 321 | 17 | $outLine = qq(alias $key $listEntry{$key}\n); | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 322 | #$outLine =~ s/>>/>/; | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 323 | 17 | push ( @outputFile, $outLine) ; | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 324 | 17 | ▶ | push ( @outputFile, $noteLine{$key}."\n") if $noteLine{$key}; | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 325 | } | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 326 | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 327 | 5 | push ( @outputFile, "\n"); | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 328 | 5 | return \@outputFile; | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 329 | } | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 330 | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 331 | ########################### sub output ####################### | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 332 | sub output | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 333 | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 334 | 1 | ▶ | { | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
Subroutine
output: called CC=1 SCAR=0.0
Pod
documented
| |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 335 | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 336 | 1 | my (@outputFile, $alias1,); | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 337 | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 338 | 1 | my $Eudora = shift; | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 339 | 1 | my $raInputArray = shift; # reference to input data as an array | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 340 | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 341 | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 342 | # Return intermediate file, as it is already in Eudora format. | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 343 | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 344 | 1 | return $raInputArray; | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 345 | } | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 346 | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 347 | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 348 | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 349 | ########################### end sub output ####################### | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 350 | 1 | 1; | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||