summaryrefslogtreecommitdiff
path: root/ext/Sys
diff options
context:
space:
mode:
authorSlaven Rezic <slaven@rezic.de>2003-01-14 21:58:54 +0100
committerRafael Garcia-Suarez <rgarciasuarez@gmail.com>2003-01-27 21:52:00 +0000
commit58ca468a076a9e91a1ca3aba10707505636900e4 (patch)
tree0673e21ac2736918a2c4dfe91d83f15db4d3c519 /ext/Sys
parentee98a1d62d9164755faacfdf3fab9cd4e3607ed6 (diff)
downloadperl-58ca468a076a9e91a1ca3aba10707505636900e4.tar.gz
Re: [perl #20274] perlbug requires dynamic loading
Message-ID: <87n0m3v6yp.fsf@vran.herceg.de> p4raw-id: //depot/perl@18597
Diffstat (limited to 'ext/Sys')
-rw-r--r--ext/Sys/Hostname/Hostname.pm18
1 files changed, 14 insertions, 4 deletions
diff --git a/ext/Sys/Hostname/Hostname.pm b/ext/Sys/Hostname/Hostname.pm
index 29825b95b0..efc8d38bae 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') {