When is a subroutine reference in @INC called?
Posted
by gvkv
on Stack Overflow
See other posts from Stack Overflow
or by gvkv
Published on 2010-03-29T20:40:31Z
Indexed on
2010/03/29
20:43 UTC
Read the original article
Hit count: 471
perl
As the title says, I'm not clear on when such a subroutine will be called. From the require page at perldoc one can write:
push @INC, \&my_sub;
sub my_sub {
my ($coderef, $filename) = @_; # $coderef is \&my_sub
...
}
but where does this go exactly? The required package or the requiring script (or package)? I've tried both with some sentinel print
statements but neither worked so clearly there is something I'm not getting.
© Stack Overflow or respective owner