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

Re: calling anonymous objects by their names

by skyknight (Hermit)
on Jul 25, 2003 at 21:04 UTC ( #277977=note: print w/replies, xml ) Need Help??


in reply to calling anonymous objects by their names

From your description, you almost certainly will want to build up a hash of your Node objects, using their names as a key so you can quickly recall them so as to perform the linkages. Your connect routine could still take their string names as arguments, but could then look them up in the hash, and call the appropriate methods on the retrieved objects.

Your general, high level algorithm will be as follows... Take the first line of your config file, split it up into individual node names, and for each name construct a Node object, set its name, and stuff the node object into the hash that you're keeping using the name as the key. Then for each subsequent line, split it into the "to" and "from" nodes, look those nodes up in your hash, and call the appropriate methods on them to form the connection.

Straightforward enough, neh?

  • Comment on Re: calling anonymous objects by their names

Log In?
Username:
Password:

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

How do I use this? | Other CB clients
Other Users?
Others cooling their heels in the Monastery: (5)
As of 2023-01-28 11:15 GMT
Sections?
Information?
Find Nodes?
Leftovers?
    Voting Booth?

    No recent polls found

    Notices?