Why does my Jabber bot only work if I'm debugging my Perl script?
Posted
by TheGNUGuy
on Stack Overflow
See other posts from Stack Overflow
or by TheGNUGuy
Published on 2010-03-27T04:37:43Z
Indexed on
2010/03/27
15:23 UTC
Read the original article
Hit count: 265
I am trying to make a jabber bot from scratch and my script is acting funny. I was originally developing the bot on a remote CentOS box, but I have switched to a local Win7 machine. Right now I'm using ActiveState Perl and I'm using Eclipse with the Perl plugin to run a debug the script.
The funny behavior I'm experiencing occurs when I run or debug the script. If I run the script using the debugger it works fine, meaning I can send messages to the bot and it can send messages to me. However when I just execute the script normally the bot sends the successful connection message then it disconnects from my jabber server and the script ends.
I'm a novice when it comes to Perl and I can't figure out what I'm doing wrong. My guess is it has something to do with the subroutines and sending the presence of the bot. (I know for sure that it has something to do with sending the bot's presence because if the presence code is removed, the script behaves as expected except the bot doesn't appear to be online.) If anyone can help me with this that would be great.
I originally had everything in 1 file but separated them into several trying to figure out my problem here are the pastebin links to my source code.
- jabberBot.pl: http://pastebin.com/cVifv0mm
- chatRoutine.pm: http://pastebin.com/JXmMT7av
- trimSpaces.pm: http://pastebin.com/SkeuWtu1
Thanks again for any help!
© Stack Overflow or respective owner