The Perl Toolchain Summit needs more sponsors. If your company depends on Perl, please support this very important event.

NAME

Util::Medley::Hostname - Utilities for dealing with hostnames.

VERSION

version 0.052

SYNOPSIS

  $util = Util::Medley::Host->new;
  
  $bool = $util->isFqdn('foobar.example.com');
  ($hostname, $domain) = $util->parseHostname('foobar.example.com');
  $shortHostname = $util->stripDomain('foobar.example.com');
    

DESCRIPTION

Utility module for slicing and dicing hostnames.

All methods confess on error.

METHODS

isFqdn

Checks if a given hostname is fully qualified.

usage:
  $bool = $util->isFqdn('foobar.example.com');
  
  $bool = $util->isFqdn(hostname => 'foobar.example.com');
  
args:
hostname [Str]

Hostname to be checked.

parseHostname

Parses the specified hostname into hostname and domain (if exists).

usage:
  ($hostname, $domain) = 
      $util->parseHostname('foobar.example.com');
  
  ($hostname, $domain) = 
      $util->parseHostname(hostname => 'foobar.example.com');
  
args:
hostname [Str]

Hostname you wish to parse.

stripDomain

Returns short-hostname for the provided hostname.

usage:
  $hostname = $util->stripDomain('foobar.example.com');
  
  $hostname = $util->stripDomain(hostname => 'foobar.example.com');
  
args:
hostname [Str]

Hostname to be stripped.