Matteo
Matteo

Reputation: 14930

Not a GLOB reference at ...IO/Select.pm line 61

I am passing an IO::Select object as handle to IO::Select::add and getting the following error:

Not a GLOB reference at ...IO/Select.pm line 61

This worked for years and since a couple of days (weeks) people are beginning to get the error. Looking online I was not able to find out if I was using the call in the wrong way or if some recent perl or DNS::Resolver update could be the cause of the problem.

I am doing the following

#!/usr/bin/perl

use IO::Select;
use Net::DNS;

# create a resolver object
my $res = Net::DNS::Resolver->new();

# create an IO::Select object
my $sel = IO::Select->new();


# perform the background DNS query
my $sock = $res->bgsend('corti.li');

# adding the socket generates the error
$sel->add($sock);

Adding some debugging I don't see anything wrong:

#!/usr/bin/perl

use Data::Dumper;
use IO::Select;
use Net::DNS;

# create a resolver object
my $res = Net::DNS::Resolver->new();

warn Dumper $res;

# create an IO::Select object
my $sel = IO::Select->new();

warn Dumper $sel;

# perform the background DNS query
my $sock = $res->bgsend('corti.li');

warn Dumper $sock;

# adding the socket generates the error
$sel->add($sock);

produces

$VAR1 = bless( {
                 'force_v4' => 0,
                 'retrans' => 5,
                 'persistent_udp' => 0,
                 'adflag' => 0,
                 'force_v6' => 0,
                 'port' => 53,
                 'answerfrom' => '',
                 'prefer_v6' => 0,
                 'defnames' => 1,
                 'tcp_timeout' => 120,
                 'udp_timeout' => 30,
                 'igntc' => 0,
                 'udppacketsize' => 0,
                 'dnsrch' => 1,
                 'recurse' => 1,
                 'srcaddr' => 0,
                 'persistent_tcp' => 0,
                 'retry' => 4,
                 'cdflag' => 0,
                 'nameserver4' => [
                                    '129.132.98.12'
                                  ],
                 'searchlist' => [
                                   'd.ethz.ch',
                                   'ethz.ch'
                                 ],
                 'tsig_rr' => undef,
                 'nameserver6' => [
                                    '2001:67c:10ec::c'
                                  ],
                 'usevc' => 0,
                 'dnssec' => 0,
                 'debug' => 0,
                 'errorstring' => 'unknown error or no error',
                 'srcport' => 0
               }, 'Net::DNS::Resolver' );
$VAR1 = bless( [
                 undef,
                 0
               ], 'IO::Select' );
$VAR1 = bless( [
                 ',
                 1,
                 undef,
                 undef,
                 undef,
                 [
                   bless( \*Symbol::GEN0, 'IO::Socket::IP' ),
                   1448125508,
                   '129.132.98.12',
                   54103
                 ]
               ], 'IO::Select' );
Not a GLOB reference at /Users/corti/perl5/perlbrew/perls/perl-5.22.0/lib/5.22.0/darwin-2level/IO/Select.pm line 61.

I am using Perl 5.22 and Net::DNS 1.03

Using Perl 5.18 and Net::DNS 0.74 the code works.

Am I doing something wrong or it is a bug?

Upvotes: 0

Views: 390

Answers (1)

Matteo
Matteo

Reputation: 14930

The problem is caused by a change in the API of Net::DNS::Resolver bgsend

See #108745: Net::DNS::Resolver bgsend

Upvotes: 1

Related Questions