in reply to Use of Typeglob

Answer to udpated question:

When used as a file handle:

When used as a tied file handle:

When used to alias function:

When used to alias other things:

Replies are listed 'Best First'.
Re^2: Use of Typeglob
by ysth (Canon) on Aug 11, 2005 at 09:50 UTC
    When used as a tied file handle:
    • I think you have no choice but to use a typeglob if you want a tied file handle.
    As of 5.8.0, filehandle ties are attached to the IO handle, not the typeglob, so you can tie even globless lexical filehandles:
    use Tie::Handle; use Symbol "geniosym"; my $fh = geniosym; tie *$fh, "Tie::StdHandle" or die; print tied(*$fh);
    The * is required only to let tie/tied know you want a filehandle tie, not a scalar tie; no actual typeglobs are used, except temporarily.