Beefy Boxes and Bandwidth Generously Provided by pair Networks
No such thing as a small change

Re: Re: (my?) problem with re-blessed references(?)

by chromatic (Archbishop)
on Dec 13, 2002 at 07:50 UTC ( #219525=note: print w/replies, xml ) Need Help??

in reply to Re: (my?) problem with re-blessed references(?)
in thread (my?) problem with re-blessed references(?)

He's using the Flyweight pattern. Check the hash keys carefully.

  • Comment on Re: Re: (my?) problem with re-blessed references(?)

Replies are listed 'Best First'.
Re: Re: Re: (my?) problem with re-blessed references(?)
by jreades (Friar) on Dec 13, 2002 at 11:34 UTC

    I think that BrowserUK's version isn't using the memory address as the hash key (which is what Abigail-II does). So rather than each object looking up parameters in the superclass like so:


    It's just calling the same key each time.

    This is why Abigail's objects need to clean up after themselves much more actively.

Re: Re: Re: (my?) problem with re-blessed references(?)
by djantzen (Priest) on Dec 13, 2002 at 11:42 UTC

    If he's using Flyweight intentionally, then the overwriting of instance data is to be expected. This is not what he wants however. The point of the Flyweight is to enable the quick flow of data through a standard framework. But he appears simply to want standard inheritance, for which package lexicals will not do for more than one instance.

    Update: D'oh! so sub phrase : lvalue { $phrase{shift}; } means that the shifted value is the memory address of the thingy and since it's an lvalue that is assigned the unique instance data. Ergo, my $opinion = ('cool!' && 'eewww!').

      See Adrianh's post below for the ({sheepish grin}stupid) reason the data was being overwritten. The inheritance is now working correctly.

      Examine what is said, not who speaks.

Log In?

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

How do I use this? | Other CB clients
Other Users?
Others chanting in the Monastery: (2)
As of 2022-08-09 04:33 GMT
Find Nodes?
    Voting Booth?

    No recent polls found