I haven't seen anybody make one yet, mainly for a pretty simple reason:
Perl is by default a single-threaded program, and to have a console MSN client, <STDIN> would have to be used in order to get user input through the console. However, <STDIN> doesn't return until the user types something and hits enter, causing the rest of the script to pause until it does so.
With a paused script, the program couldn't ping MSN's servers to find new information, so you wouldn't get any new IM's people are sending until you send a message. Not only that, but if the client doesn't ping MSN's servers often enough, MSN disconnects them.
That being said, most people I've seen who tried to do something like this have failed.
There are some solutions such as using Term::ReadKey and threads (to make a second thread for typing in commands while not interfering with the main MSN thread), but they're a little bit more complicated.
But I don't know of anybody who's done this. Pretty much everyone I know who knows how to use Term::ReadKey or threads also knows how user friendly a console MSN client would be (which is, not very user friendly at all). For instance, your typing would be interrupted by messages and you might lose your place:
Code:
Send Message> hey Joh[16:32:06] John: hey!
n, can you send me an e-[16:32:30] Mike: so did you finish that homework assignment yet?
mail with a link to th[16:33:02] John: what's up?
e login page?
See, that's some potential output of a console MSN client. You'd be simply trying to type "Hey John, can you send me an e-mail with a link to the login page?" but as you're typing, your other friends are sending messages which are also printed out to the same console window you're typing in, which visually interrupts your typing and if you lose your place it's hard to find what you've already written to pick up where you left off.
So, the newbies can't get over the threading problem, and the experienced coders realize how inefficient it is. _________________ Current Site (2008) http://www.cuvou.com/
Joined: 19 Jul 2004 Posts: 556 Location: Los Angeles, CA votes: 1
Posted: Wed Sep 06, 2006 8:11 am Post subject:
Ive seen things like this done with ANSI locate and things like that... where you can set he position on the console of text that you write. That way you can make it not over write the text you type.
Term::ReadKey can be used instead of threads to make the input non-blocking (unlike STDIN). Term::ReadKey basically waits of one key to be pressed, but you can time this out to wait less than a second for a new key. You can then append each character you get to a string until you get a return character, then send that string.
If you want to use threads you can make a sheared thread array that you could use as a "buffer" that your STDIN loop writes to and your threaded msn loop then reads.
I may give this some more thought and work something like this out. It could definitely be fun. _________________ [ matt ]
Joined: 05 Jul 2004 Posts: 31 Location: Almere, The Netherlands
Posted: Wed Sep 06, 2006 9:49 am Post subject:
Look at this: http://tmsnc.sourceforge.net/
Its not made in Perl, but it does show it is perfectly possible.
I'm going to try it now, on linux because it doesnt work on windows. _________________ 3D chat program I'm making