Well, the best thing is to take it one step at a time. First, get used to how Net::Oscar works by itself. Then once you have a good feel for it, try adding the Tk front end. Things are greatly complicated by using threads with Tk, further compounded by your novice status with both Tk and threads. You might want to try looking thru the results of a perlmonk's searchbox search for "Tk threads". It's all been discussed before, and you should be able to get some sample tk-w-thread code to experiment with.
I don't know if you need threads at all (being unfamiliar with Net::Oscar.) You may be able to do it with some other easier method, like in your
while(1) {
$oscar->do_one_loop();
# Do stuff
#update your Tk widgets here
$mw->DoOneEvent( DONT_WAIT |
ALL_EVENTS );
}
The above is just an idea, since you are using a while(1) loop, which will interfere with Tk's mainloop. You can call DoOneEvent to keep Tk going and responding to events.
All in all, you are asking for us to give you a simple code example, for a fairly complex program..... not gonna happen. I did see there is a POE component module for Net::Oscar, maybe you would want to look at that?
As far as simple sending of a message goes, there is an "oscartest" script contained in the module distribution, I would start with that. Sorry, I don't have AIM going so I'm not able to try it. Maybe post a another topnode question.... "How do I use Net::Oscar"? Or Net::OSCAR: Having trouble getting started
I'm not really a human, but I play one on earth.
flash japh
Posts are HTML formatted. Put <p> </p> tags around your paragraphs. Put <code> </code> tags around your code and data!
Titles consisting of a single word are discouraged, and in most cases are disallowed outright.
Read Where should I post X? if you're not absolutely sure you're posting in the right place.
Please read these before you post! —
Posts may use any of the Perl Monks Approved HTML tags:
- a, abbr, b, big, blockquote, br, caption, center, col, colgroup, dd, del, details, div, dl, dt, em, font, h1, h2, h3, h4, h5, h6, hr, i, ins, li, ol, p, pre, readmore, small, span, spoiler, strike, strong, sub, summary, sup, table, tbody, td, tfoot, th, thead, tr, tt, u, ul, wbr
You may need to use entities for some characters, as follows. (Exception: Within code tags, you can put the characters literally.)
| |
For: |
|
Use: |
| & | | & |
| < | | < |
| > | | > |
| [ | | [ |
| ] | | ] |
Link using PerlMonks shortcuts! What shortcuts can I use for linking?
See Writeup Formatting Tips and other pages linked from there for more info.