I have inherited an application that has 70+ packages/modules. For security reasons, I cannot post code. But, I don't necessarily need help finding the problem. Rather, I need help with a strategy to find the problem.

When I run this application, I get a series of warnings that look like:

    Subroutine someSubNameHere redefined at /some/path/to/moduleName.pm line someLineNumberHere.

This happens for one package (call it fileB.pm) and it only happens once. But, the the pattern of 'use' statement chains through the numerous packages is not trivial.

It appears to me that fileA.pm is 'using' fileB.pm which 'uses' fileC.pm which 'uses' fileD.pm which uses fileB.pm, again. When the app starts up it begins to compile fileA, hits the 'use' statement and picks up fileB, hits a 'use' statement and picks up fileC and so on. It finally hits the last 'use' in the chain and loads fileB.pm. At that point it falls back to complete loading fileD, then fileC, then fileB. At that point, the subs in fileB have already been loaded with the associated namespace (fileB) and it warns about redefining them.

At least, that is what I think is happening. My hope is that there is some mechanism for tracking these 'use' chains at compile time (run time is too late).

Any ideas?

I may have to just start at the top and track each 'use' chain until it hits 'fileB.pm' and then, after some sequences of 'use' statements, 'uses' fileB.pm, a second time.

I hate being taunted a second time. (Said with a faux french accent.)(Oblique Monty Python ref.)

Thanks

PS - I've tried to register for the site and I never get a password emailed.... at least, not for several hours.

In reply to How to located cause of 'Subroutine SomeSubName redefined...' warnings by Anonymous Monk

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.