in reply to Re: Passing a file handle to a sub. I still don't get it.
in thread Passing a file handle to a sub. I still don't get it.

How do you know what $_ really is in your program?

I can see that get printed on milk cartons one day :) (Talk to your children! A message from the government of Canada.)

Anyway, all kidding aside, here's what I'm doing, and now It Just Works, so thank you all for your thoughts and input. The calling sub:
#... blah blah blah open(FH, $opts{-file}); $opts{-handle} = *FH; return $parser->from_handle(%opts); #... la dee da
And the callee:
#... stick out left leg while ( readline($opts{-handle}) ) { if ( $_ ) { # ... frobnicate } } # return right leg

Replies are listed 'Best First'.
Re^3: Passing a file handle to a sub. I still don't get it.
by QM (Parson) on Jun 09, 2005 at 21:04 UTC
    It may work for you now, but do you know why? You've fixed it, but can you duplicate it in other contexts?

    I notice that you no longer take a reference to a glob, but the glob directly. My quick check shows that this works (though the glob reference shows more info in the debugger with the x command).

    -QM
    --
    Quantum Mechanics: The dreams stuff is made of