|
Mail::AddressSort - Sort an array of email addresses |
Mail::AddressSort - Sort an array of email addresses
use Mail::AddressSort;
$list = Mail::AddressSort->new(); $list->input(@addresses); (@addresses)=$list->sorted(); $batch=$list->batches(-maxRecipients => [int] , -byHost);
Mail::AddressSort is useful for sorting large lists of email addresses. A Mail::AddressSort object is capable of taking an array of email addresses and returning it in either a single sorted list, or an array reference to array references that contain of the same list broken down into smaller batches.
The email addresses are sorted by taking a reverse of the fully qualified domain name instead of just using the literal string. This can be helpful in sorting the list by mailhosts.
For example, the following email addresses:
cpj1@visi.com, chrisj@MR.Net
are reversed for the purposes of sorting to:
com.visi@cpj1, net.mr@chrisj
The -maxRecipients option will automatically be set if it isn't specified. If the number of addresses in the list is less than 100, it will be set to 1/5th of that number. If the number of addresses is over 100, it will be set to 100.
If -byHost is specified, each list in the array will only contain email addresses with a matching FQDN.
Chris Josephes (chrisj@mr.net)
Version 1.0
|
Mail::AddressSort - Sort an array of email addresses |