I am using Firefox::Marionette, and it works great (normally), but is now giving this error:

% perl -MFirefox::Marionette -e 'my $f=Firefox::Marionette->new()' Undefined address for Socket::pack_sockaddr_in at /Users/<user>/perl5/ +lib/perl5/Firefox/Marionette.pm line 7134.

The line in question is this one:

$sock_addr = Socket::pack_sockaddr_in( $port, Socket::inet_aton($host) );

So I'm guessing that Socket::inet_aton($host) is the culprit

metacpan.org/pod/Socket tells us that:

...If passed a hostname that cannot be resolved, returns undef.

From this I'll assume that the hostname cannot be resolved, but we're not even opening a url yet...

Testing Socket yields predictable results:

% perl -MSocket -e'defined (my $a=inet_aton("garbage")) or die"dead"; +print unpack "V", $a;' dead at -e line 1. % perl -MSocket -e'defined (my $a=inet_aton("127.0.0.1")) or die"dead" +; print unpack "V", $a;' 16777343

It seems to do its job when passed something sensible

I usually work from home, but today I went in to the office, and got the error.
Could this be caused by a change in the network?
I'll know later today if it works at home.

System details:

MacOS 14.5
Apple M2
perl ver. 5.34.2

I tried flushing cache with sudo dscacheutil -flushcache; sudo killall -HUP mDNSResponder, but this made no difference

I also tried changing the perl version (using plenv), but then I have to install Firefox::Marionette for the new version, and surprise-surprise; installation fails with the same error :p

Is this the right way to flush DNS on MacOS 14.5?

How can I find out what is actually passed to inet_aton when it fails?

What else can I do to debug this?


In reply to Undefined address for Socket::pack_sockaddr_in by WithABeard

Title:
Use:  <p> text here (a paragraph) </p>
and:  <code> code here </code>
to format your post, it's "PerlMonks-approved HTML":



  • Posts are HTML formatted. Put <p> </p> tags around your paragraphs. Put <code> </code> tags around your code and data!
  • Titles consisting of a single word are discouraged, and in most cases are disallowed outright.
  • Read Where should I post X? if you're not absolutely sure you're posting in the right place.
  • Please read these before you post! —
  • Posts may use any of the Perl Monks Approved HTML tags:
    a, abbr, b, big, blockquote, br, caption, center, col, colgroup, dd, del, details, div, dl, dt, em, font, h1, h2, h3, h4, h5, h6, hr, i, ins, li, ol, p, pre, readmore, small, span, spoiler, strike, strong, sub, summary, sup, table, tbody, td, tfoot, th, thead, tr, tt, u, ul, wbr
  • You may need to use entities for some characters, as follows. (Exception: Within code tags, you can put the characters literally.)
            For:     Use:
    & &amp;
    < &lt;
    > &gt;
    [ &#91;
    ] &#93;
  • Link using PerlMonks shortcuts! What shortcuts can I use for linking?
  • See Writeup Formatting Tips and other pages linked from there for more info.