Beefy Boxes and Bandwidth Generously Provided by pair Networks
Think about Loose Coupling
 
PerlMonks  

Re: dumping lexical filehandles (solved)

by LanX (Saint)
on Sep 12, 2014 at 15:32 UTC ( [id://1100413]=note: print w/replies, xml ) Need Help??


in reply to dumping lexical filehandles (updated)

> So lexical file handles are implemented as hidden global stash entries, which are destroyed when the lexical var falls out of scope ?

fascinating, seems like scoping behavior is implemented by localizing the hidden stash entry :)

#!perl use Data::Dumper qw/Dumper/; open my $fh,"<",'/tmp/tst'; my $outer=$fh; print 0+($outer == $fh),": ", Dumper $fh; { open my $fh,"<",'/tmp/tst'; print 0+($outer == $fh),": ", Dumper $fh; }

out

1: $VAR1 = \*{'::$fh'}; 0: $VAR1 = \*{'::$fh'};

Cheers Rolf

(addicted to the Perl Programming Language and ☆☆☆☆ :)

Log In?
Username:
Password:

What's my password?
Create A New User
Domain Nodelet?
Node Status?
node history
Node Type: note [id://1100413]
help
Chatterbox?
and the web crawler heard nothing...

How do I use this?Last hourOther CB clients
Other Users?
Others admiring the Monastery: (6)
As of 2024-03-29 13:01 GMT
Sections?
Information?
Find Nodes?
Leftovers?
    Voting Booth?

    No recent polls found