I'm using Devel::TraceUse with a script that uses the 'lib' module:
use lib 'my-lib'; use Fcntl;

Running perl -d:TraceUse script.pl results in:

Modules used from ./script.pl: lib, line 2 (0.003514) Fcntl, line 1 (0.000265) Fcntl, line 1 (0.000531) Fcntl, line 1 (0.000847) Fcntl, line 1 (0.001094) Fcntl, line 8 (0.001204) XSLoader, line 1 (1.7e-05) XSLoader, line 1 (0.000449) XSLoader, line 1 (0.000715) XSLoader, line 1 (0.000965) XSLoader, line 61 (0.001219)
If I add a for (@INC) { print "INC: $_\n" } after the use lib line, I get this output:
INC: my-lib/5.8.8/i386-linux-thread-multi INC: my-lib/5.8.8 INC: my-lib/5.8.6 INC: my-lib INC: CODE(0x98f8e08) INC: ...(lots of other directories omitted)... ... Modules used from ./script.pl: lib, line 2 (0.003122) Fcntl, line 1 (0.000253) Fcntl, line 1 (0.000494) Fcntl, line 1 (0.000747) Fcntl, line 1 (0.000995) Fcntl, line 8 (0.001262) XSLoader, line 1 (0.0002) XSLoader, line 1 (0.000423) XSLoader, line 1 (0.000659) XSLoader, line 1 (0.000736) XSLoader, line 61 (0.001646)
So it seems that when use lib adds multiple directories to @INC things go screwy for Devel::TraceUse.

I haven't run into this problem if use lib 'my-lib' only adds one directory to @INC.

Is there a way to fix this?


In reply to Devel::TraceUse bizarreness by perl5ever

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.