Net::LDAP::Constant unexpectedly overwriting $_

[email protected] (Marc Lehmann)
Newsgroups perl.ldap
Message-ID <[email protected]>
Hi!

I found that requiring Net::LDAP::Constant trashes the global $_ variable
with "=cut". This can have quite unintended consequences when $_ is already
used by outer code (for example, when loading modules in a loop).

As a general rule, in perl, when you use a global variable, you should save
and restore it (map, for etc. all do this).

But Net::LDAP::Constant doesn't:

   while(<DATA>) {
     last if /^=cut/;

May I suggest a "local $_" before that loop so it doesn't trash global
variables anymore?

Thanks a lot!

-- 
                The choice of a       Deliantra, the free code+content MORPG
      -----==-     _GNU_              http://www.deliantra.net
      ----==-- _       generation
      ---==---(_)__  __ ____  __      Marc Lehmann
      --==---/ / _ \/ // /\ \/ /      [email protected]
      -=====/_/_//_/\_,_/ /_/\_\
lmpx.com only provides a reader for public news (NNTP) servers. It is not affiliated with the servers or forums shown here and is not responsible for the content of articles, which is written by their respective authors.