Beefy Boxes and Bandwidth Generously Provided by pair Networks
There's more than one way to do things
 
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 ( [id://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
Domain Nodelet?
Node Status?
node history
Node Type: note [id://888511]
help
Chatterbox?
and the web crawler heard nothing...

How do I use this?Last hourOther CB clients
Other Users?
Others learning in the Monastery: (7)
As of 2024-04-24 10:19 GMT
Sections?
Information?
Find Nodes?
Leftovers?
    Voting Booth?

    No recent polls found