Beefy Boxes and Bandwidth Generously Provided by pair Networks
There's more than one way to do things

Re: Getting the FQDN using Net::Domain

by Anonymous Monk
on Jan 26, 2012 at 02:12 UTC ( #950013=note: print w/replies, xml ) Need Help??

in reply to Getting the FQDN using Net::Domain

why the module behaves this way ?

Um, because that is why? I take the comment at its word :)

  # try looking in /etc/resolv.conf
  # putting this here and assuming that it is correct, eliminates
  # calls to gethostbyname, and therefore DNS lookups. This helps
  # those on dialup systems.

So if I see that correctly, relying on an entry in the "search" block is a bit risky, isn't it?

How exactly?

You can always use Sys::Hostname?

I see this caused problem for someone, Bug #73410 for libnet

Replies are listed 'Best First'.
Re^2: Getting the FQDN using Net::Domain
by nickolsen (Initiate) on Jan 26, 2012 at 09:30 UTC
    Thanks for your reply and especially for mentioning the bug report.

    How exactly?
    As you can see in my example (and in the bugreport):
    The "search" block contains only the local domain part by default, but it can be changed to whatever suits your needs. Therefor the module relies on information which might be right but don't have to be.

    Sys::Hostname is not an option for me, as I need to know the FQDN and not only the host-part of the hostname. It calls "uname -n" [0], which does not have to know the domain-part.

    Here's another example:
    mobile:~# head -n2 /etc/resolv.conf domain search mobile:~# python -c 'import socket; print socket.getfqdn();' mobile:~# hostname -f mobile:~# perl -e 'use Net::Domain qw/ hostfqdn /; print(hostfqdn . "\ +n");' mobile:~# perl -e 'use Sys::Hostname; print(hostname . "\n");' mobile

    Anyways, the bug report completely describes my issue, so maybe things will get fixed soon.


      Anyways, the bug report completely describes my issue, so maybe things will get fixed soon.

      Sure, if soon you mean 1 month to 3 or more years :)

      Might get fixed quicker if you fork

Log In?

What's my password?
Create A New User
Node Status?
node history
Node Type: note [id://950013]
and all is quiet...

How do I use this? | Other CB clients
Other Users?
Others romping around the Monastery: (12)
As of 2017-02-25 17:25 GMT
Find Nodes?
    Voting Booth?
    Before electricity was invented, what was the Electric Eel called?

    Results (366 votes). Check out past polls.