From: Slaven Rezic Date: Tue, 14 Jan 2003 20:58:54 +0000 (+0100) Subject: Re: [perl #20274] perlbug requires dynamic loading X-Git-Url: http://git.shadowcat.co.uk/gitweb/gitweb.cgi?a=commitdiff_plain;h=58ca468a076a9e91a1ca3aba10707505636900e4;p=p5sagit%2Fp5-mst-13.2.git Re: [perl #20274] perlbug requires dynamic loading Message-ID: <87n0m3v6yp.fsf@vran.herceg.de> p4raw-id: //depot/perl@18597 --- 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') {