# from Eric Wilhelm
# on Friday 19 January 2007 05:49 pm:
>However, I noticed that perl is somewhat tricky about how it handles
>circular dependency. The @INC hook won't see another 'use foo' if
>foo.pm says 'use bar' and bar.pm says 'use foo'. My guess is that it
>defers the compile until after all of the requires have returned
>filehandles.
Ok, I give up. After several hours of trying to figure out how leverage
this hack to get a full "who used what" trace, my conclusion is that it
isn't the right way to go about it. One issues is that AutoLoader
wants to use %INC to decide how to load the .al files. I'm sure there
are some other troubles. Basically, you would have to completely
emulate the internal do/require mechanism *and* load a hacked
AutoLoader, but even then you're stuck with at least one lingering %INC
entry.
So, who wants to hack a hook into their perl interpreter source and
report back? Essentially, just the ability to override
CORE::Global::do or something in that neighborhood would do the trick.
The @INC hook is handy, but really no better than checking %INC at the
END block and dumping an aggregate "these modules got loaded, don't ask
me where" report, since the blow-by-blow coming out of the @INC hook
isn't able to reliably report every use() (even if you go back and
revisit each module as its own entry point, the circularity will get
you if segfaults don't (at least on my linux system(s) (5.8.4/8), Wx
won't run reliably under -d.))
--Eric
--
"Insert random misquote here"
---------------------------------------------------
http://scratchcomputing.com
---------------------------------------------------