App-Chronicle
view release on metacpan or search on metacpan
lib/Chronicle/Plugin/Snippets/Meta.pm view on Meta::CPAN
#
if ($gcos)
{
$gcos =~ s/,+$//g;
$Chronicle::GLOBAL_TEMPLATE_VARS{ "build_fullname" } = $gcos
if ( $gcos && length($gcos) );
}
}
#
# Now try to populate the hostname of the build-system too.
#
# Again we start from the environment, then run `hostname` if the
# environment isn't set.
#
my $hostname = $ENV{ 'HOSTNAME' };
if ( !$hostname )
{
#
# If not we'll look for a hostname via the Sys::Hostname module.
#
$hostname = Sys::Hostname::hostname();
#
# The previous line will have probably returned a short-name.
#
# Try to expand it into FQDN. If that fails - well at least we tried.
#
my @values = ( gethostbyname($hostname) );
if ( scalar @values )
{
$hostname = $values[0];
}
}
if ($hostname)
{
#
# If the hostname is qualified
#
if ( $hostname =~ /^([^.]+)\.(.*)/ )
{
my $short = $1;
my $domain = $2;
#
# Set the long/short versions
#
$Chronicle::GLOBAL_TEMPLATE_VARS{ "build_host_long" } = $hostname;
$Chronicle::GLOBAL_TEMPLATE_VARS{ "build_host_short" } = $short;
}
else
{
#
# Otherwise we just have the short, and
# can't guess the domain name.
#
# c.f. `domainname`.
#
$Chronicle::GLOBAL_TEMPLATE_VARS{ "build_host_short" } = $hostname;
}
}
}
1;
=head1 LICENSE
This module is free software; you can redistribute it and/or modify it
under the terms of either:
a) the GNU General Public License as published by the Free Software
Foundation; either version 2, or (at your option) any later version,
or
b) the Perl "Artistic License".
=cut
=head1 AUTHOR
Stuart Skelton
=cut
( run in 1.632 second using v1.01-cache-2.11-cpan-39bf76dae61 )