Re: [perl #20274] perlbug requires dynamic loading
authorSlaven Rezic <slaven@rezic.de>
Tue, 14 Jan 2003 20:58:54 +0000 (21:58 +0100)
committerRafael Garcia-Suarez <rgarciasuarez@gmail.com>
Mon, 27 Jan 2003 21:52:00 +0000 (21:52 +0000)
Message-ID: <87n0m3v6yp.fsf@vran.herceg.de>

p4raw-id: //depot/perl@18597

ext/Sys/Hostname/Hostname.pm

index 29825b9..efc8d38 100644 (file)
@@ -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') {