You can avoid editing all those modules by adding a hook into @INC as documented in require:

#!/usr/bin/perl -w -T # install a 'hook' into @INC / see: perldoc -f require BEGIN { unshift @INC, '.'; # replaces 'use lib(.);' unshift @INC, sub { printf "***** TRACE: use %-20s with ARGV=%s\n", $_[1], join(', ', @ARGV); return; }; } BEGIN { print 'before using my module: '.join(', ',@ARGV)."\n" } #use lib qw(.); # removed: would shift hook to 2nd position, disabling + tracing use Module; # modified: sub import { shift @ARGV; } use Module2; # just a copy of the unmodified Module.pm BEGIN { print 'after using my module: '.join(', ',@ARGV)."\n" } __END__ > ./script.pl a b c before using my module: a, b, c ***** TRACE: use Module.pm with ARGV=a, b, c beginning my module1: a, b, c ending my module1: a, b, c ***** TRACE: use Module2.pm with ARGV=b, c beginning my module2: b, c ending my module2: b, c after using my module: b, c

If you have several modules, you could at least narrow the problem down to two candidates. Then, you can add debugging code to those modules. Hopefully, no other module fiddles with @INC at the same time... Good luck!

Update: OK, here are sample modules Module.pm and Module2.pm:

package Module; BEGIN { print 'beginning my module1: ' . join(', ',@ARGV)."\n" } # do lots of stuff sub import { shift @ARGV ; } BEGIN { print 'ending my module1: ' . join(', ',@ARGV)."\n" } 1;
package Module2; BEGIN { print 'beginning my module2: ' . join(', ',@ARGV)."\n" } # do lots of stuff BEGIN { print 'ending my module2: ' . join(', ',@ARGV)."\n" } 1;

Update2: In case the approach described above does not work:

BEGIN { *CORE::GLOBAL::require = sub { printf "===== TRACE: req %-20s with +ARGV=%s\n", $_[0], join(', ' ,@ARGV); CORE::require( $_[0] ); }; }

Update3: Trivial, but might also help to narrow down candidate modules:
     find my/modules -name \*.pm -exec egrep -l @ARGV {} \;


In reply to Re: debugging during compile by Perlbotics
in thread debugging during compile by pileofrogs

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.