Beefy Boxes and Bandwidth Generously Provided by pair Networks
We don't bite newbies here... much
 
PerlMonks  

Re: Re: Re: Re: OO - problem with inheritance

by uwevoelker (Pilgrim)
on Jan 14, 2002 at 21:56 UTC ( #138633=note: print w/replies, xml ) Need Help??


in reply to Re: Re: Re: OO - problem with inheritance
in thread OO - problem with inheritance

Hello Frag,
thank you for your answer. I agree with you that I could solve my problem by copying the hash in ¶meter_config. But instead I go for ValidateNewParameter.
  • Comment on Re: Re: Re: Re: OO - problem with inheritance

Replies are listed 'Best First'.
Re: Re: Re: Re: Re: OO - problem with inheritance
by IlyaM (Parson) on Jan 14, 2002 at 22:08 UTC
    by copying the hash

    Note that just copying the hash doesn't work for data structure you have used. Values of hash are hashrefs themselves so new copy will reuse parts of copied data structure. Thus changes in copy of data structure affect original data structure.

    --
    Ilya Martynov (http://martynov.org/)

      Yes, I know. I have to iterate over each hash and make copies. A simple $ref1 = $ref is not enough.
      Thanks.
        When I want to do deep cloning I just use dclone from Storable. Works for data structures of any complexity. There is also exist module Clone.

        --
        Ilya Martynov (http://martynov.org/)

Log In?
Username:
Password:

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

How do I use this? | Other CB clients
Other Users?
Others taking refuge in the Monastery: (4)
As of 2022-05-29 09:47 GMT
Sections?
Information?
Find Nodes?
Leftovers?
    Voting Booth?
    Do you prefer to work remotely?



    Results (101 votes). Check out past polls.

    Notices?