Beefy Boxes and Bandwidth Generously Provided by pair Networks
Keep It Simple, Stupid
 
PerlMonks  

Re: OO theory question

by Abigail-II (Bishop)
on Jun 09, 2004 at 15:00 UTC ( [id://362752]=note: print w/replies, xml ) Need Help??


in reply to OO theory question

Well, you basically will need somewhere in your program a piece where all the irc connections work together (unless you want to give each irc connection its own separate thread or process) - and that's called the select loop. OO is nice for modelling data, but it doesn't do the program flow for you. Deep down, the heart of your program will be a simple loop:
while true do is there anything to read or write on my IRC connections? if so, read or write, else maybe do something else done
There are several modules out there that will help you implement it - but you'll need the loop.

Abigail

Replies are listed 'Best First'.
Re^2: OO theory question
by Forsaken (Friar) on Jun 09, 2004 at 15:05 UTC
    basically option 1 then. in that context, would it make more sense to have the ->new method do a simple bless, and implement another method, perhaps ->connect, that creates connections as properties of the object returned by ->new?
      IMO, a constructor should only construct, and not do anything else. Otherwise, your subclassing classes will be forced to call your constructor, and that's a major pain in the ass if the subclass wants to do MI.

      Abigail

        so, to sum it up. 1 constructor that does just that, construct. 1 method to add a connection, and 1 final method which is called once that starts the main loop and gets everything running?

Log In?
Username:
Password:

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

How do I use this?Last hourOther CB clients
Other Users?
Others examining the Monastery: (5)
As of 2024-03-29 15:08 GMT
Sections?
Information?
Find Nodes?
Leftovers?
    Voting Booth?

    No recent polls found