Beefy Boxes and Bandwidth Generously Provided by pair Networks
Clear questions and runnable code
get the best and fastest answer
 
PerlMonks  

Re: Replacing objects

by sundialsvc4 (Monsignor)
on Dec 19, 2013 at 00:39 UTC ( #1067752=note: print w/ replies, xml ) Need Help??


in reply to Replacing objects

The superficial answer, to your immediate question, is (of course) “yes.”

By that I mean:   the bless() primitive (simply...) associates a particular class/object definition with a particular object-instance, such that the runtime interpreter, when presented with a “method-call,” will use that particular association in its effort to resolve the call.   Therefore, “yes... it is technically possible to, on-the-fly, change that association, just by calling bless() again.”

But, now, the “XY Problem” Question ...   What, exactly, are you trying to accomplish here?   (Hey, haven’t we a-l-l been in this very spot?)   A thing that “technically speaking, the interpreter ‘allows” you to do,” might or might not be the best ‘There’s More Than One Way To™’ way to do it, but “by now, we’re just too damm close to it.”   Therefore, please tell us more about your ultimate goal, so that The Peanut Gallery might assist you in assessing whether the Tree that you are currently barking up, really is the right Tree.   Perhaps there is another, better, “way to do it.”   :-)


Comment on Re: Replacing objects

Log In?
Username:
Password:

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

How do I use this? | Other CB clients
Other Users?
Others rifling through the Monastery: (3)
As of 2014-09-01 14:36 GMT
Sections?
Information?
Find Nodes?
Leftovers?
    Voting Booth?

    My favorite cookbook is:










    Results (13 votes), past polls