Beefy Boxes and Bandwidth Generously Provided by pair Networks
Syntactic Confectionery Delight
 
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?
[ambrus]: Corion: I don't understand what you mean by protocol-only here. Can you explain why AnyEvent::HTTP is wrong for you? Are you a HTTP client or a server?

How do I use this? | Other CB clients
Other Users?
Others wandering the Monastery: (6)
As of 2016-12-07 15:36 GMT
Sections?
Information?
Find Nodes?
Leftovers?
    Voting Booth?
    On a regular basis, I'm most likely to spy upon:













    Results (130 votes). Check out past polls.