I would store users as a hash, rather than an array, making it much faster to determine whether the person is already in the list, or not, and also making deletions simpler.

my %roster; # to test for person being present, using a hash: if ( $roster{$jid} ) { .... } # to delete people when they leave: delete $roster{$jid};

I would re-initialize the list from the channel, say every half hour, to avoid going out of sync with reality. You might have some bug which loses people, or there might be a network problem which results in people joining or leaving without you being properly notified.

As for your code not working as you want it to, are you testing individual routines one by one, using Test::More or other testing frameworks? Can you run the program under the debugger, and determine data, inputs and outputs just before and just after an arrival ... use a private channel, where you can control arrivals. How about outputting a flood of data to a log file, and manually determining whether it's Doing The Right Thing?

As Occam said: Entia non sunt multiplicanda praeter necessitatem.


In reply to Re: Jabber MUC bot channel list problem. by TomDLux
in thread Jabber MUC bot channel list problem. by Jarek

Title:
Use:  <p> text here (a paragraph) </p>
and:  <code> code here </code>
to format your post, it's "PerlMonks-approved HTML":



  • 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:
    & &amp;
    < &lt;
    > &gt;
    [ &#91;
    ] &#93;
  • Link using PerlMonks shortcuts! What shortcuts can I use for linking?
  • See Writeup Formatting Tips and other pages linked from there for more info.