http://www.perlmonks.org?node_id=1007743


in reply to Re^2: Cancel/no-op a require
in thread Cancel/no-op a require

OK, so now the correct incantation should be:

unshift @INC, sub { my ($self, $name) = @_; # load the module first local @INC = grep { !ref($_) || $_ != $self } @INC; require $name; # add logging to the package # ignore this hook my $line = 0; return sub { unless ($line++) { $_ = "1;\n"; return 1; } return 0; } };