Beefy Boxes and Bandwidth Generously Provided by pair Networks Frank
There's more than one way to do things
 
PerlMonks  

Cloning Graph::Directed Objects

by arunhorne (Pilgrim)
on Jul 24, 2002 at 05:08 UTC ( [id://184738]=perlquestion: print w/replies, xml ) Need Help??

This is an archived low-energy page for bots and other anonmyous visitors. Please sign up if you are a human and want to interact.

arunhorne has asked for the wisdom of the Perl Monks concerning the following question:

Monks,

I have created a Graph::Directed object. I want to make a copy of it to work on whilst keeping the original graph intact (allowing me to easily revert to the original graph). I want to clone the object. However when I do the following:

$TMPGRAPH = $GRAPH

it is unsurprisingly the case that operating on TMPGRAPH alters GRAPH. How can I clone $GRAPH such that modifying TMPGRAPH will not affect $GRAPH?

Thanks,

____________
Arun

Replies are listed 'Best First'.
Re: Cloning Graph::Directed Objects
by amphiplex (Monk) on Jul 24, 2002 at 05:10 UTC
    Shouldn't copy do that ?

    From the docs:
    $C = $G->copy; Returns a new graph $C corresponding to the graph $G.

    ---- amphiplex

Log In?
Username:
Password:

What's my password?
Create A New User
Domain Nodelet?
Node Status?
node history
Node Type: perlquestion [id://184738]
Approved by zejames
help
Sections?
Information?
Find Nodes?
Leftovers?
    Notices?
    hippoepoptai's answer Re: how do I set a cookie and redirect was blessed by hippo!
    erzuuliAnonymous Monks are no longer allowed to use Super Search, due to an excessive use of this resource by robots.