Bug#845200: libnet-dns-perl: Setting $/ to "\r\n" breaks Net::DNS

Niko Tyni ntyni at debian.org
Mon Nov 21 19:55:02 UTC 2016


On Mon, Nov 21, 2016 at 01:28:02PM +0100, Benoit Panizzon wrote:
> Package: libnet-dns-perl
> Version: 0.81-2+deb8u1
> Severity: normal
 
> I'm not so sure this is a bug or some kind of expected behaviour.
> 
> I was coding some email application and for that I needed to set the 'line ending'
> $/ to "\r\n".

> Some more debugging revealed that $res->nameservers also failed to resolve the name-
> server because it send the requests to 'localhost'.

Hi, I don't think it's (much of) a bug in the Net::DNS that it doesn't
defend against changed $/. There are many global variables in Perl
that can have wide ranging effects on external modules. It doesn't
really scale to have all the modules defensively reset these special
variables. Instead, you should localize them so that the changes you
need only apply to your own code.

Quoting perlvar.pod:

    You should be very careful when modifying the default values of most
    special variables described in this document. In most cases you want
    to localize these variables before changing them, since if you don't,
    the change may affect other modules which rely on the default values
    of the special variables that you have changed.

-- 
Niko Tyni   ntyni at debian.org



More information about the pkg-perl-maintainers mailing list