unshift @INC, sub { my ($self, $name) = @_; $INC{$name} = 1; # load the module first local @INC = grep { !ref($_) || $_ != $self } @INC; require $name; # add logging to the package return (); };