From 9c562abb8bd5c2c0861db820f48bf5088defea6b Mon Sep 17 00:00:00 2001 From: Michael Mikonos <127171689+mknos@users.noreply.github.com> Date: Mon, 25 Mar 2024 19:33:31 +0800 Subject: [PATCH] mail: overloaded hostname() definition causes error (#519) * In package "mailer", hostname() is a setter method for object attribute "hostname" (L48) * Sys::Hostname auto-imports a hostname() which causes a conflict; as a result I cannot send a mail message with 'm' command * Prevent auto-import of Sys::Hostname symbols to resolve this --- bin/mail | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/bin/mail b/bin/mail index 9be23072..81def111 100755 --- a/bin/mail +++ b/bin/mail @@ -41,7 +41,7 @@ package @ISA=qw(PerlPowerTools::mailprog); use IO::Socket; -use Sys::Hostname; # Claims to be standard? +use Sys::Hostname qw(); %mailer::fields=( user => undef, @@ -83,7 +83,7 @@ sub new { } # Find my address... if (! defined $ENV{HOSTNAME}) { - my $hostname=hostname(); + my $hostname = Sys::Hostname::hostname(); if (! $hostname) { die "Unable to find a reasonable hostname. Use \$HOSTNAME.\n"; }