Jabber ボットを作成しようとしていますが、メッセージを待っている間、それを実行し続けることができません。スクリプトを継続的に実行するにはどうすればよいですか? 理論的には、メッセージをチェックしてそれに応じて反応するように設定した while ループを持つサブルーチンを呼び出してみましたが、スクリプトはそのように動作しません。
これが私のソースです:http://pastebin.com/03Habbvh
# Jabber ボットのコールバックを設定 $jabberBot->SetMessageCallBacks(chat=>\&chat); $jabberBot->SetPresenceCallBacks(available=>\&welcome,unavailable=>\&killBot); $jabberBot->SetCallBacks(receive=>\&prnt,iq=>\&gotIQ); $jabberBot->PresenceSend(type="available"); $jabberBot->Process(1); サブウェルカム { print "ようこそ!\n"; $jabberBot->MessageSend(to=>$jbrBoss->GetJID(),subject=>"",body=>"こんにちは!",type=>"chat",priority=>10); &続けて; } サブプリント { print $_[1]."\n"; } #$jabberBot->MessageSend(to=>$jbrBoss->GetJID(),subject=>"",body=>"こんにちは!グローバル...",type=>"chat",priority=>10); #$jabberBot->Process(5); #&続けて; サブチャット { 私 ($sessionID,$msg) = @_; $dump->pl2xml($msg); if($msg->GetType() ne 'get' && $msg->GetType() ne 'set' && $msg->GetType() ne '') { 私の $jbrCmd = &trimSpaces($msg->GetBody()); my $dbQry = $dbh->prepare("SELECT コマンド、承認 FROM コマンド WHERE メッセージ = '".lc($jbrCmd)."'"); $dbQry->execute(); if($dbQry->rows() > 0 && $jbrCmd !~ /^insert/si) { 私の $ref = $dbQry->fetchrow_hashref(); $dbQry->finish(); $jabberBot->MessageSend(to=>$msg->GetFrom(),subject=>"",body=>$ref->{'acknowledgement'},type=>"chat",priority=>10); eval $ref->{'コマンド'}; &続けて; } そうしないと { $jabberBot->MessageSend(to=>$msg->GetFrom(),subject=>"",body=>"わからなかった!",type=>"チャット",priority=>10); $dbQry->finish(); &続けて; } } } サブゴットIQ { print "iq\n"; } サブトリムスペース { 私の $string = $_[0]; $string =~ s/^\s+//; #先頭のスペースを削除 $string =~ s/\s+$//; #末尾のスペースを削除 $文字列を返します。 } サブkeepItGoing { print "keepItGoing!\n"; 私の $proc = $jabberBot->Process(1); while(定義済み($proc) && $proc != 1) { $proc = $jabberBot->Process(1); } } サブキルボット { print "殺害\n"; $jabberBot->MessageSend(to=>$_[0]->GetFrom(),subject=>"",body=>"Logging Out!",type=>"chat",priority=>10); $jabberBot->Process(1); $jabberBot->Disconnect(); 出口; }