|
| Author |
Message |
Xyem Young One

Joined: 03 Jan 2005 Posts: 54
  
|
Posted: Wed Oct 12, 2005 5:23 pm Post subject: Without msn.pm |
|
|
*brushes dust off self* I return!
I took a break from programming my bot and did some other programming for a while (databases, games etc.) but I have returned but with slightly different intentions.
I am trying to make an MSN client (using the Tk modules) with a "bot-buddy" sort of thing, however, because the client will be only very simple (pretty much just IM, maybe display pictures/personal messages too) I want to program my client without msn.pm (not that I don't think its an outstanding piece of work).
I have drawn against a problem though, which I cannot solve by examining msn.pm (Which I have done) in it's method. The problem is reading from the socket connected to the MSN servers. I can't figure out how it knows when to read it so it doesn't block (useful as it will need to interact with the user).
Could anyone explain how it does this so I can progress with my client?
NOTE: I have found a semi-way around it by pinging the server in the socket reading loop and dropping out the loop when the reply from the ping is recieved, so it can update the client, though the problems with this are obvious (client "freezes" if reply from ping is never received for whatever reason) |
|
| Back to top |
|
 |
Mojave Almost An Agent

Joined: 01 Nov 2003 Posts: 1434
 
|
Posted: Wed Oct 12, 2005 5:43 pm Post subject: |
|
|
| I guess my question is why don't you want to use MSN.pm? It is simple, it does simple IM and display pictures. What complicated things does it do that you don't need? |
|
| Back to top |
|
 |
darkmonkey The Merovingian

Joined: 18 Apr 2004 Posts: 2557 Location: London, England
     votes: 7
|
Posted: Wed Oct 12, 2005 5:50 pm Post subject: |
|
|
(And why not just delete the "complicated things"?) _________________ ~ Josh
[ Need bot hosting on a dedicated server? PM me. ] |
|
| Back to top |
|
 |
Xyem Young One

Joined: 03 Jan 2005 Posts: 54
  
|
Posted: Wed Oct 12, 2005 5:52 pm Post subject: |
|
|
| I guess it's more just the challenge of handling it all myself and I want to avoid using modules wherever possible and use my own code. |
|
| Back to top |
|
 |
darkmonkey The Merovingian

Joined: 18 Apr 2004 Posts: 2557 Location: London, England
     votes: 7
|
Posted: Wed Oct 12, 2005 5:54 pm Post subject: |
|
|
When you say "avoid modules" you mean avoid pre-made modules, right? You're still gonna modularise it? _________________ ~ Josh
[ Need bot hosting on a dedicated server? PM me. ] |
|
| Back to top |
|
 |
Xyem Young One

Joined: 03 Jan 2005 Posts: 54
  
|
Posted: Wed Oct 12, 2005 5:56 pm Post subject: |
|
|
| I don't know how to write modules, all the code will be in the "executable" code, but yes I meant premade modules |
|
| Back to top |
|
 |
Cer Upgraded Agent

Joined: 03 Feb 2004 Posts: 3776 Location: Michigan
  votes: 4
|
Posted: Wed Oct 12, 2005 6:00 pm Post subject: |
|
|
I don't see the use in reinventing the wheel. If you protest using modules all the time, you'd be doing a LOT more work to do little things (which the modules would handle) rather than actually program your program...
i.e. you would spend a lot more time on the MSN connection part than you'd even do with using PerlTk (or why not just skip the Tk modules and write a GUI yourself too?) _________________ Current Site (2008) http://www.cuvou.com/ |
|
| Back to top |
|
 |
Xyem Young One

Joined: 03 Jan 2005 Posts: 54
  
|
Posted: Wed Oct 12, 2005 6:07 pm Post subject: |
|
|
My dislike to using modules mainly stems from when I try to compile an executable. I've used about 3 different things to try and do this and every one complains about modules...
I suppose using modules makes it... too easy and the challenge goes. Though I guess it may be a good idea that for the time being I use modules and once I have it working start "extracting" the modules into my own code to make it self-reliant. |
|
| Back to top |
|
 |
darkmonkey The Merovingian

Joined: 18 Apr 2004 Posts: 2557 Location: London, England
     votes: 7
|
Posted: Wed Oct 12, 2005 6:13 pm Post subject: |
|
|
Large files of code make the program inefficient. Splitting it up means it only needs to exucute the seperate file rather than everything at once.
Why not use PerlApp that comes with the PDK?
http://www.activestate.com/Products/Perl_Dev_Kit/ _________________ ~ Josh
[ Need bot hosting on a dedicated server? PM me. ] |
|
| Back to top |
|
 |
Xyem Young One

Joined: 03 Jan 2005 Posts: 54
  
|
Posted: Wed Oct 12, 2005 6:22 pm Post subject: |
|
|
| I thought when you used modules it loaded/read it all at compile so it wouldn't make any difference if the code was in the same file, if not making it faster by having the code in one place... |
|
| Back to top |
|
 |
Mojave Almost An Agent

Joined: 01 Nov 2003 Posts: 1434
 
|
Posted: Wed Oct 12, 2005 6:59 pm Post subject: |
|
|
| Quote: | | I suppose using modules makes it... too easy and the challenge goes. |
haha, in that case you have set very low goals for yourself. I use modules to avoid the boring stuff. For me, the MSN module is a useful tool to write much more interesting code on top of. Set some higher goals and you'll get plenty of challenges. Rehashing your own msn is a pretty low goal.
If you want it fast and you're rewriting everything from scratch, why not use C? |
|
| Back to top |
|
 |
Xyem Young One

Joined: 03 Jan 2005 Posts: 54
  
|
Posted: Wed Oct 12, 2005 7:12 pm Post subject: |
|
|
Low goals = achievable
 |
|
| Back to top |
|
 |
Mojave Almost An Agent

Joined: 01 Nov 2003 Posts: 1434
 
|
Posted: Wed Oct 12, 2005 7:21 pm Post subject: |
|
|
| What I really meant to say is that it's been done. Sure MSN.pm could be improved, extra features added, etc., but the basic code you need to write an MSN bot is there. If it didn't work, then rewriting it would make sense. But it does. So, at least for me, rewriting it means recreating something rather than building on top of something. If you're just doing it to learn how the MSN protocol works and develop your skills, cool. I'm just thinking it's more interesting to create something new. |
|
| Back to top |
|
 |
Xyem Young One

Joined: 03 Jan 2005 Posts: 54
  
|
Posted: Wed Oct 12, 2005 7:28 pm Post subject: |
|
|
| I understand exactly what you mean Mojave, our whole society and technology is based on building on top of what we have. But your right, I am interested in learning the MSN protocol and want to deal with it directly |
|
| Back to top |
|
 |
Cer Upgraded Agent

Joined: 03 Feb 2004 Posts: 3776 Location: Michigan
  votes: 4
|
Posted: Wed Oct 12, 2005 7:58 pm Post subject: |
|
|
With PerlApp in the Perl Dev Kit, you can *compile* your program into a standalone executable.
If you were planning on leaving your code as Perl to be interpreted at runtime, then you can always just include some of its harder-to-find modules with it when you zip it. i.e. your program could have its own "lib" folder, and you can use lib to use that. That's what my Perl programs tend to do oftentimes.
But if you meant compile as in turn it into an EXE, the PerlApp handles that VERY well. It's actually easier to use modules with PerlApp than to use normal Perl includes, because PerlApp compiles all the modules together into the final one-file standalone EXE. _________________ Current Site (2008) http://www.cuvou.com/ |
|
| Back to top |
|
 |
|