From 58ca468a076a9e91a1ca3aba10707505636900e4 Mon Sep 17 00:00:00 2001 From: Slaven Rezic Date: Tue, 14 Jan 2003 21:58:54 +0100 Subject: [PATCH] Re: [perl #20274] perlbug requires dynamic loading Message-ID: <87n0m3v6yp.fsf@vran.herceg.de> p4raw-id: //depot/perl@18597 --- ext/Sys/Hostname/Hostname.pm | 18 ++++++++++++++---- 1 file changed, 14 insertions(+), 4 deletions(-) diff --git a/ext/Sys/Hostname/Hostname.pm b/ext/Sys/Hostname/Hostname.pm index 29825b9..efc8d38 100644 --- a/ext/Sys/Hostname/Hostname.pm +++ b/ext/Sys/Hostname/Hostname.pm @@ -5,17 +5,27 @@ use strict; use Carp; require Exporter; -use XSLoader (); require AutoLoader; our @ISA = qw/ Exporter AutoLoader /; our @EXPORT = qw/ hostname /; -our $VERSION = '1.1'; +our $VERSION; our $host; -XSLoader::load 'Sys::Hostname', $VERSION; +BEGIN { + $VERSION = '1.1'; + { + local $SIG{__DIE__}; + eval { + require XSLoader; + XSLoader::load('Sys::Hostname', $VERSION); + }; + warn $@ if $@; + } +} + sub hostname { @@ -23,7 +33,7 @@ sub hostname { return $host if defined $host; # method 1' - try to ask the system - $host = ghname(); + $host = ghname() if defined &ghname; return $host if defined $host; if ($^O eq 'VMS') { -- 2.7.4