Beefy Boxes and Bandwidth Generously Provided by pair Networks Joe
Problems? Is your data what you think it is?
 
PerlMonks  

Re: untie() and tied() and UNTIE dont work right inside FETCH with tied scalar

by Anonyrnous Monk (Hermit)
on Feb 16, 2011 at 14:45 UTC ( #888511=note: print w/ replies, xml ) Need Help??


in reply to untie() and tied() and UNTIE dont work right inside FETCH with tied scalar

The problem is, that tied() doesn't work inside the FETCH method. untie() does work, but it never calls UNTIE method.  (...)

Is this a bug in perl or some attempt perl is making at preventing recursion?

Presumably the latter, which makes perfect sense, IMHO.  In other words, within the scope of the tied package, the scalar acts as if it was untied (as correctly reported by tied), so you can access the variable without causing infinite recursion. — You can still untie it, however.

As for the UNTIE method not being called: if you do need to execute the code of that method, you could maybe call it directly, in addition to untie, when you're doing it from within the tied package.


Comment on Re: untie() and tied() and UNTIE dont work right inside FETCH with tied scalar

Log In?
Username:
Password:

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

How do I use this? | Other CB clients
Other Users?
Others perusing the Monastery: (6)
As of 2014-04-20 07:52 GMT
Sections?
Information?
Find Nodes?
Leftovers?
    Voting Booth?

    April first is:







    Results (485 votes), past polls