NAME

String::ShortenHostname - tries to shorten hostnames while keeping them meaningful

VERSION

version 0.006

SYNOPSIS

use String::ShortenHostname;

my $sh = String::ShortenHostname->new( length => 20 );
$sh->shorten('zumsel.haushaltswarenabteilung.einzelhandel.de');
# zumsel.hau~g.ein~l~>

$sh->cut_middle(0);
$sh->shorten('zumsel.haushaltswarenabteilung.einzelhandel.de');
# zumsel.haus~.einz~~>

$sh->force(0);
$sh->shorten('zumsel.haushaltswarenabteilung.einzelhandel.de');
# zumsel.haus~.einz~.de

$sh->domain_edge(undef);
$sh->shorten('zumsel.haushaltswarenabteilung.einzelhandel.de');
# zumsel.haush.einze.de

DESCRIPTION

String::ShortenHostname will try to shorten the hostname string to the length specified. It will cut each domain part to a given length from right to left till the string is short enough or the end of the domain has been reached.

Options:

length (required)

The desired maximum length of the hostname string.

keep_digits_per_domain (default: 5)

Cut each domain part at this length.

domain_edge (default: '~')

If defined this string will be used to replace the end of each domain truncated to indicate that it was truncated.

cut_middle (default: 1)

Will do the cut one character before the last.

force (default: 1)

If specified the module will force the length by cutting the result string.

force_edge (default: '~>')

If defined this string will be used to replace the end of the string to indicate that it was truncated.

AUTHOR

Markus Benning <me@w3r3wolf.de>

COPYRIGHT AND LICENSE

This software is copyright (c) 2014 by Markus Benning.

This is free software; you can redistribute it and/or modify it under the same terms as the Perl 5 programming language system itself.