Skip Menu |

This queue is for tickets about the Net-DNS-TestNS CPAN distribution.

Report information
The Basics
Id: 28959
Status: new
Priority: 0/
Queue: Net-DNS-TestNS

People
Owner: Nobody in particular
Requestors: kane [...] cpan.org
Cc:
AdminCc:

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



Subject: Can not reuse sockets when using N::D::TestNS
Greetings, when using N::D::TestNS in a test script, it's not possibly currently to reuse the same port numbers in the same script when using code like this: for( 1, 2 ) { $t = Net::DNS::TestNS->new(...); $t->run; $t->stop; } Something like the followign error will occur: Setting up server for: 127.0.0.1,9002 Setting up listening sockets for 127.0.0.1... Creating TCP socket for 127.0.0.1 - Couldn't create TCP socket: Address already in use at /usr/lib/perl5/site_perl/5.8.5/Net/DNS/Nameserver.pm line 116 Net::DNS::Nameserver::new('Net::DNS::TestNS::Nameserver', 'LocalPort', 9002, 'LocalAddr', 127.0.0.1, 'ReplyHandler', 'CODE(0x92d8b04)', 'Verbose', 1, ...) called at /usr/lib/perl5/site_perl/5.8.5/Net/DNS/TestNS.pm line 329 Net::DNS::TestNS::new('Net::DNS::TestNS', '/tmp/8Qhm67C14C', 'HASH(0x92d8b4c)') called at t/02_nameserver.t line 113 Can't call method "run" without a package or object reference at t/02_nameserver.t line 114. The reason for this is that that even though you fork first when calling run, the socket is already opened by Net::DNS::Nameserver when you call ->new. Therefor, the socket is not closed when you kill the child =/