Skip Menu |

This queue is for tickets about the Sys-Hostname-Long CPAN distribution.

Report information
The Basics
Id: 20898
Status: new
Priority: 0/
Queue: Sys-Hostname-Long

People
Owner: Nobody in particular
Requestors: rrauenza [...] cup.hp.com
Cc:
AdminCc:

Bug Information
Severity: (no value)
Broken in: (no value)
Fixed in: (no value)



Subject: Improved/reliable method on HPUX
Date: Tue, 08 Aug 2006 11:03:07 -0700
To: bug-Sys-Hostname-Long [...] rt.cpan.org
From: Rich Rauenzahn <rrauenza [...] cup.hp.com>
I think this is going to be the most reliable method. The socket one makes me wary due to multihomed systems... not sure what it would do? DB<27> $hostname = `hostname` DB<28> $hostname =~ s/\..*//sm; # probably there is a more efficient way to truncate at . DB<29> @res = gethostbyname($hostname) DB<30> print $res[0] hp46t243.cup.hp.com DB<31> Here's the diff: # rcsdiff Long.pm RCS file: Long.pm,v retrieving revision 1.1 rdiff -r1.1 Long.pm 135a136,147 Show quoted text
> 'gethostbyname_on_hostname' => { > 'title' => 'Get Host by Name on Hostname', > 'description' => '', > 'exec' => sub { > my $hostname = `/bin/hostname`; > chomp $hostname; > $hostname =~ s{\..*}{}sm; > my @r = gethostbyname($hostname); > return $r[0]; > }, > }, >
188c200,201 < --- Show quoted text
> } elsif ($^O eq 'hpux') { > $hostlong = dispatcher('gethostbyname_on_hostname');
# ./testall.pl Method |Title |Result -----------------|---------------------------------|--------------------------------------- AUTOMATIC |via gethostbyname_on_hostname |hp46t243.cup.hp.com exec_hostname |Execute "hostname" |hp46t243 exec_hostname_dom|Execute "hostname" and "domainnam|hp46t243. su: Invalid ID exec_hostname_fqd|Execute "hostname --fqdn" | gethostbyname |Get Host by Name | gethostbyname_on_|Get Host by Name on Hostname |hp46t243.cup.hp.com ip |Network Socket IP then Hostname v|15.244.29.243 network |Network Socket hostname (not DNS)|hp46t243.cup.hp.com uname |POSIX::unae |hp46t243 win32_registry1 |WIN32 Registry | win32_registry2 |WIN32 Registry | # # uname -a HP-UX hp46t243 B.11.23 U ia64 1664326337 unlimited-user license # /rjr/perl/bin/perl -V Summary of my perl5 (revision 5 version 8 subversion 8) configuration: Platform: osname=hpux, osvers=11.23, archname=IA64.ARCHREV_0-thread-multi uname='hp-ux hp46t243 b.11.23 u ia64 1664326337 unlimited-user license ' config_args='undef' hint=recommended, useposix=true, d_sigaction=define usethreads=define use5005threads=undef useithreads=define usemultiplicity=define useperlio=define d_sfio=undef uselargefiles=define usesocks=undef use64bitint=undef use64bitall=undef uselongdouble=undef usemymalloc=n, bincompat5005=undef Compiler: cc='cc', ccflags =' -D_POSIX_C_SOURCE=199506L -D_REENTRANT -Ae -D_HPUX_SOURCE -Wl,+vnocompatwarnings -mt -I/rjr/gdbm/include -D_LARGEFILE_SOURCE -D_FILE_OFFSET_BITS=64 ', optimize='+Ofast', cppflags='-Aa -D__STDC_EXT__ -D_HPUX_SOURCE -D_POSIX_C_SOURCE=199506L -D_REENTRANT -Ae -D_HPUX_SOURCE -Wl,+vnocompatwarnings -mt -I/rjr/gdbm/include' ccversion='', gccversion='', gccosandvers='' intsize=4, longsize=4, ptrsize=4, doublesize=8, byteorder=4321 d_longlong=define, longlongsize=8, d_longdbl=define, longdblsize=16 ivtype='long', ivsize=4, nvtype='double', nvsize=8, Off_t='off_t', lseeksize=8 alignbytes=8, prototype=define Linker and Libraries: ld='/usr/bin/ld', ldflags =' -L/usr/lib/hpux32 -L/rjr/gdbm/lib' libpth=/usr/lib/hpux32 /rjr/gdbm/lib /lib /usr/lib /usr/ccs/lib /usr/local/lib libs=-lcl -lnsl -lnm -lndbm -lgdbm -ldl -ldld -lm -lsec -lpthread -lc perllibs=-lcl -lnsl -lnm -ldl -ldld -lm -lsec -lpthread -lc libc=/usr/lib/hpux32/libc.so, so=so, useshrplib=false, libperl=libperl.a gnulibc_version='' Dynamic Linking: dlsrc=dl_hpux.xs, dlext=so, d_dlsymun=undef, ccdlflags='-Wl,-E -Wl,-B,deferred ' cccdlflags='+Z', lddlflags='-b +vnocompatwarnings -L/usr/lib/hpux32 -L/rjr/gdbm/lib' Characteristics of this binary (from libperl): Compile-time options: MULTIPLICITY PERL_IMPLICIT_CONTEXT PERL_MALLOC_WRAP USE_ITHREADS USE_LARGE_FILES USE_PERLIO USE_REENTRANT_API Built under hpux Compiled at Jul 28 2006 10:57:07 @INC: /rjr/perl-5.8.8/lib/5.8.8/IA64.ARCHREV_0-thread-multi /rjr/perl-5.8.8/lib/5.8.8 /rjr/perl-5.8.8/lib/site_perl/5.8.8/IA64.ARCHREV_0-thread-multi /rjr/perl-5.8.8/lib/site_perl/5.8.8 /rjr/perl-5.8.8/lib/site_perl .