The thread module for PERL does not seem to work with Irssi. I can't get more information on this because the folk at #Irssi never respond.
I need to have the script check a database every 5 minutes. Now I thought this would be possible with multi-threading in PERL, but once you include the module Irssi will thrown an Exception.
Ironically, if I try and construct a while loop that terminates itself after a set amount of time the Irssi client just hangs.
Any suggestions?
Code
    use strict;
    use warnings;
    use threads;
    use Thread::Queue;
my $q = Thread::Queue->new();    # A new empty queue
    # Worker thread
    my $thr = threads->create(
        sub {
            # Thread will loop until no more work
            while (defined(my $item = $q->dequeue())) {
                # Do work on $item
            }
        }
    );
Errors in Irssi (not all of them, but same thing, cant locate package):
13:30| Can't locate package Irssi::ServerSetup for
          @Irssi::Irc::ServerSetup::ISA at
          /home/nullby7e/.irssi/scripts/test.pl line 27.
13:30|
13:30| Can't locate package Irssi::Nick for @Irssi::Irc::Nick::ISA at
          /home/nullby7e/.irssi/scripts/test.pl line 27.
13:30|
13:30| Can't locate package Irssi::ServerConnect for
          @Irssi::Irc::ServerConnect::ISA at
          /home/nullby7e/.irssi/scripts/test.pl line 27.