NAME

Sort::Key::Domain - Sort domain names

SYNOPSIS

use Sort::Key::Domain qw(domainkeysort);

my @sorted = domainkeysort { $_->domain_name } @url;

DESCRIPTION

This module extends the Sort::Key family of modules to support sorting of domain names.

FUNCTIONS

The functions that can be imported from this module are as follow:

domainsort @data

Return the domain names in @data sorted.

rdomainsort @data

Returns the domain names in @data sorted in descending order.

domainkeysort { CALC_KEY($_) } @data

Returns the elements on @array sorted by the domain name resulting from applying them CALC_KEY.

rdomainkeysort { CALC_KEY($_) } @data

Returns the elements on @array sorted by the domain name resulting from applying them CALC_KEY but in descending order.

mkkey_domain $domain

Transforms the given domain name in a key suitable for lexicographically sorting.

Specifically it reverses the subdomains in the string. For instance, the domain name a.b.c is converted into c.b.a. An interesting property of this transformation is that applying a second time just undoes it.

domainsort_inplace @data
rdomainsort_inplace @data
domainkeysort_inplace { CALC_KEY($_) } @data
rdomainkeysort_inplace { CALC_KEY($_) } @data

These functions are similar respectively to domainsort, rdomainsort, domainsortkey and rdomainsortkey, but they sort the array @data in place.

SEE ALSO

Sort::Key.

COPYRIGHT AND LICENSE

Copyright (C) 2014 by Salvador Fandiño (sfandino@yahoo.com)

This library is free software; you can redistribute it and/or modify it under the same terms as Perl itself, either Perl version 5.18.2 or, at your option, any later version of Perl 5 you may have available.

1 POD Error

The following errors were encountered while parsing the POD:

Around line 105:

Non-ASCII character seen before =encoding in 'Fandiño'. Assuming UTF-8