Beefy Boxes and Bandwidth Generously Provided by pair Networks
We don't bite newbies here... much
 
PerlMonks  

Re: How to use @INC coderef hooks (perldoc wrong)

by LanX (Bishop)
on Apr 04, 2014 at 12:30 UTC ( #1081115=note: print w/replies, xml ) Need Help??


in reply to How to use @INC coderef hooks

same case, tried fiddling around with it and the documentation seems wrong.

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.

update

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)

Log In?
Username:
Password:

What's my password?
Create A New User
Node Status?
node history
Node Type: note [id://1081115]
help
Chatterbox?
[marto]: I think that actually caught up with me yesterday, felt a really sharp pain where my neck meets my skull.
[Corion]: marto: Ouch, yeah...
[marto]: the boys uncle will take them for a couple of hours this afternoon :)

How do I use this? | Other CB clients
Other Users?
Others meditating upon the Monastery: (7)
As of 2017-11-19 11:32 GMT
Sections?
Information?
Find Nodes?
Leftovers?
    Voting Booth?
    In order to be able to say "I know Perl", you must have:













    Results (280 votes). Check out past polls.

    Notices?