No such thing as a small change | |
PerlMonks |
dumping lexical filehandles (updated)by LanX (Saint) |
on Sep 12, 2014 at 15:11 UTC ( [id://1100409]=perlquestion: print w/replies, xml ) | Need Help?? |
LanX has asked for the wisdom of the Perl Monks concerning the following question:
Brothers! I'm trying to understand how lexical filehandles are dumped:
apparently $fh holds the ref to a glob named "\$fh" , i.e. with sigle as part of the name! But inspecting the STASH doesn't show this entry... I know that the common way to copy a bare filehandle to a scalar is my $fh=\*FH but this is confusing me. Is this an implementation workaround or what am I missing?
editJust after posting I'm realizing that I may be inspecting the wrong ($ = scalar) slot of the $fh glob. I'll update further tests.
updateOK inspecting only the glob reveals it's existence in the stash:
but I'm still a bit confused ... So lexical file handles are implemented as hidden global stash entries, which are destroyed when the lexical var falls out of scope ?
Cheers Rolf (addicted to the Perl Programming Language and ☆☆☆☆ :)
Back to
Seekers of Perl Wisdom
|
|