in reply to How to use @INC coderef hooks
it says
If there is no filehandle (previous item), then this subroutine is expected to generate one line of source code per call, writing the line into $_ and returning 1, then returning 0 at "end of file".
but this is never the case, passing undef doesn't help.
The "previous item" always has to be a filehandle.
Otherwise the generator-callback "this subroutine" is never called.
Passing a dummy filehandle helps.
DARN! looking at this example Re: Cancel/no-op a require reveals the problem with the documentation.
In the hook you can either return FILEHANDLE, CODEREF; or return CODEREF; but the docs imply return undef, CODEREF; for the second case.
Cheers Rolf
( addicted to the Perl Programming Language)
|
|---|