perl5ever has asked for the wisdom of the Perl Monks concerning the following question:
use lib 'my-lib'; use Fcntl;
Running perl -d:TraceUse script.pl results in:
If I add a for (@INC) { print "INC: $_\n" } after the use lib line, I get this output: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)
So it seems that when use lib adds multiple directories to @INC things go screwy for Devel::TraceUse.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)
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?
|
|---|
| Replies are listed 'Best First'. | |
|---|---|
|
Re: Devel::TraceUse bizarreness
by ikegami (Patriarch) on Jul 05, 2009 at 18:14 UTC | |
|
Re: Devel::TraceUse bizarreness
by perl5ever (Pilgrim) on Jul 06, 2009 at 15:45 UTC | |
|
Re: Devel::TraceUse bizarreness
by Khen1950fx (Canon) on Jul 06, 2009 at 19:45 UTC |