From: Jarkko Hietaniemi Date: Tue, 15 Apr 1997 14:21:53 +0000 (+0300) Subject: Sys::Syslog: hyphens in hostnames X-Git-Url: http://git.shadowcat.co.uk/gitweb/gitweb.cgi?a=commitdiff_plain;h=6c696f6b7d7a60691ee1a672145eca09129d9019;p=p5sagit%2Fp5-mst-13.2.git Sys::Syslog: hyphens in hostnames Jerome Abela writes: > > In sub connect of Sys::Syslog, someone wrote: > ($host) = $host_uniq =~ /(\w+)/; > > But, if the name contains a '-', it gets truncated. The RE should > rather be someting like [a-zA-Z0-9-]+, shouldn't it ? p5p-msgid: 199704151421.RAA19693@alpha.hut.fi --- diff --git a/lib/Sys/Syslog.pm b/lib/Sys/Syslog.pm index 2da1d76..471be11 100644 --- a/lib/Sys/Syslog.pm +++ b/lib/Sys/Syslog.pm @@ -201,7 +201,7 @@ sub connect { unless ($host) { require Sys::Hostname; my($host_uniq) = Sys::Hostname::hostname(); - ($host) = $host_uniq =~ /(\w+)/; + ($host) = $host_uniq =~ /([\w\-]+)/; } my $udp = getprotobyname('udp'); my $syslog = getservbyname('syslog','udp');