I need some guidance in my usage of Devel::GC::Helper. I thought it would show unused variables, but in this context it seems to be showing leaked CODE / ARRAYs. I have a perl script, with an external module wherein I have added:

use Devel::GC::Helper; my $leaks = Devel::GC::Helper::sweep; my $cnt = 0; for my $leak (@$leaks) { print "Leaked $leak\n"; print "detail: [@$leak]\n" if ($cnt); $cnt++; }

which gives

Leaked CODE(0x81f6e8c) Leaked ARRAY(0x81f6e98) Use of uninitialized value in join or string at eyemod.pm line 196. Use of uninitialized value in join or string at eyemod.pm line 196. detail: [ ] Leaked ARRAY(0x81f6ea4) Use of uninitialized value in join or string at eyemod.pm line 196. Use of uninitialized value in join or string at eyemod.pm line 196. Use of uninitialized value in join or string at eyemod.pm line 196. Use of uninitialized value in join or string at eyemod.pm line 196. Use of uninitialized value in join or string at eyemod.pm line 196. detail: [ ] Leaked ARRAY(0x81f6ed4) Use of uninitialized value in join or string at eyemod.pm line 196. detail: [ eyemod.pm eyemod import] Leaked ARRAY(0x8148be0) detail: [] Leaked ARRAY(0x8149708) detail: []

The detail is an effort on my side to show the content of the array in question, since I'm to dumb to translate ARRAY(0x8149708) into an array name. I'm too dumb to understand how to use perl -d for this. ;)

Does anyone perhaps know if I should be concerned about the Leaked warnings?

Secondly, does anyone know of a method to track down unused variables in large perl scripts, without the manual rigmarole? My searches lead me to perl_checker, but this seems to be intended for Mandriva.

Niel


In reply to Devel::GC::Helper and unused variables by 0xbeef

Title:
Use:  <p> text here (a paragraph) </p>
and:  <code> code here </code>
to format your post, it's "PerlMonks-approved HTML":



  • Posts are HTML formatted. Put <p> </p> tags around your paragraphs. Put <code> </code> tags around your code and data!
  • Titles consisting of a single word are discouraged, and in most cases are disallowed outright.
  • Read Where should I post X? if you're not absolutely sure you're posting in the right place.
  • Please read these before you post! —
  • Posts may use any of the Perl Monks Approved HTML tags:
    a, abbr, b, big, blockquote, br, caption, center, col, colgroup, dd, del, details, div, dl, dt, em, font, h1, h2, h3, h4, h5, h6, hr, i, ins, li, ol, p, pre, readmore, small, span, spoiler, strike, strong, sub, summary, sup, table, tbody, td, tfoot, th, thead, tr, tt, u, ul, wbr
  • You may need to use entities for some characters, as follows. (Exception: Within code tags, you can put the characters literally.)
            For:     Use:
    & &amp;
    < &lt;
    > &gt;
    [ &#91;
    ] &#93;
  • Link using PerlMonks shortcuts! What shortcuts can I use for linking?
  • See Writeup Formatting Tips and other pages linked from there for more info.