in reply to (updated) Perl6::FH

Cool! The idea can also be used for noting whether a file is UTF8 or byte oriented, something that's a PITA right now.

Why are you duplicating the handle rather than using the original one passed in?

— John

Replies are listed 'Best First'.
Re: Re: Perl6::FH
by japhy (Canon) on Jun 29, 2001 at 00:43 UTC
    I can't use the same handle, because that's what's getting tied. I'm duplicating the file descriptor.
    # this is what happens when I change # bless [ $fh, (@_ == 3 ? $sep : ()) ], $class; # to # bless [ $real, (@_ == 3 ? $sep : ()) ], $class; Deep recursion on subroutine "Perl6::FH::AUTOLOAD" at /usr/local/lib/p +erl5/5.6.0/Tie/Handle.pm line 202. Deep recursion on subroutine "Tie::StdHandle::EOF" at /export/home/jpi +nyan/lib/Perl6/FH.pm line 40. Segmentation fault


    japhy -- Perl and Regex Hacker
      OK, because you can't call the underlying readline otherwise. I thought there was a find-the-thing-I'm-tied-to function somewhere? Ah, found it: tied "Returns a reference to the object underlying VARIABLE (the same value that was originally returned by the tie call that bound the variable to a package.)"

      —John