develooper Front page | perl.perl5.porters | Postings from February 2000

Re: handle autoviv bug + proposed fix

Nick Ing-Simmons
February 26, 2000 14:53
Re: handle autoviv bug + proposed fix
Message ID:
Tom Christiansen <> writes:
>Autovivified filehandles do not enjoy the same privileges as real
>handles do.  The problem is that they get autovivified to glob refs,
>not to globs.  

That was a "deliberate" mistake to make them mimic IO::* which
they are supposed to help make obsolete - I was not sure which to pick 
at the time. (I was sure that references to *glob{'IO'} was NOT what 
I wanted...)

>This is good for subsequent blessing, but it means
>there's a niggling inconsistency: the method call dispatch logic
>does not consider those two interchangeable, but should.  Watch.

>What should happen, though, is for to pretend that a ref(GLOB) is
>a GLOB, 

Or we could auto-vivify as globs.
But I quite like the idea of making this more consistent.

>just as we do in the rest of the places this occurs, such
>as all these valid cases:

>I imagine that to fix this problem, once you've determined that
>you've got a reference, you should do more than that first if{}
>(or, alternately, the last one) is doing right now.  I believe that
>you should check whether you've got a non-object reference that's
>actually referring to a GLOB, and if so, use some of the logic from
>the else{} case to fix this up accordingly.
>What do you think?

I think that is entirely reasonable approach on the surface at least.
Is this the "last" issue I wonder ...

Nick Ing-Simmons Perl Programming lists via nntp and http.
Comments to Ask Bjørn Hansen at | Group listing | About