in reply to Warning from XML/Twig.pm : Use of uninitialized value in numeric eq (==)

The problem is nowhere near that line. Notice the "during global destruction". That means your data structure survived past the end of the program. At that point, Perl needs to use extraordinary measures to destroy the remaining variables, so variables aren't necessarily freed in the right order. That's what happened here, and that's why you're getting the warning.

Your data structure was stored in a global variable or it was leaked. If it's the former, undefine the global variable before exiting. It's the latter, you'll have to hunt down the memory leak. I believe there are tools in the Devel:: namespace to help you find memory cycles and memory leaks.

  • Comment on Re: Warning from XML/Twig.pm : Use of uninitialized value in numeric eq (==)

Replies are listed 'Best First'.
Re^2: Warning from XML/Twig.pm : Use of uninitialized value in numeric eq (==)
by jthomas (Acolyte) on May 14, 2010 at 05:49 UTC

    Hi all,

    Thanks for all the hints...It helped me a lot to solve the problem. Looks like it was indeed a problem with weakref and leaks.

    From XML::Twig man page

    dispose Useful only if you don't have Scalar::Util or WeakRef installed. Reclaims properly the memory used by an XML::Twig object. As the o +bject has circular references it never goes out of scope, so if you w +ant to parse lots of XML documents then the memory leak becomes a pro +blem. Use $twig->dispose to clear this problem.

    Same dispose method was available with OpenOffice::OOdoc module and problem got solved when started using that.

    Thanks a lot monks