Hi.
I got a huge problem with a irc bot i've built. Today i use threads but it's almost impossible to live with due to the memory leaking problem. Is there another tool that can work almost the same as threads. For a brief examle: (a on public sub)
if (lc substr($text,0,5) eq ".help") {
my $info = substr($text,6);
my $auth = autcheck($info, $event->{nick}, $event->{host});
$helpthr = threads->new(\&help);
$helpthr->detach;
}
This is just an example where i tread the help sub. Sometimes i have HUGE subs running on public commands, some takes about 30 mins to complete. Thats why i need threads so the main code wont be locked up and wait for the sub to exit. So ppl can run parallell, Say 5 ppl type help at the same time they should all be served directly.
Is there any other "simple" way to do this? I've tried forks but that didnt work good at all. Been reading a little about POE but just can figure out if it could be a sollution to my problem or not.
Please help a desperate dude out here :)
update (broquaint): fixed formatting
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.