Coderefs in @INC

Ovid on 2006-09-27T14:44:12

I needed to find out just what was loading a module and the order things were loaded in. I seemed to recall a module which would do that,but I couldn't remember it (short of breaking out Devel::Trace). Then I remembered I could just shove a coderef in @INC and be done with it:

use Carp 'cluck';

BEGIN {
    unshift @INC => sub {
        my ( $coderef, $filename ) = @_;
        cluck("Found the culprit!") if $filename eq 'Path/To/Your/Module.pm';
    };
}


Devel::TraceUse

chromatic on 2006-09-27T17:07:18

Were you perhaps thinking of Devel::TraceUse?