zentara,

as I want to exchange results of a program running on several computer
I don't want that the client gets an echo of his own lines. Therefore the ID,
which is added by the Reader
push @chat, "$self->{ID}\t$1";
and removed by the Writer and send if $ID ne $1:
$chat[$i] =~ /(.+?)\s(.+)[\n\r]*/; print $socket $2,$EOL if ( $1 ne $ID && $2 ne $kill);
So the Writer skips the lines with its ID, ok? But this is easy to change!!

The occurence of the warning of the line 120:

%E = (map { $1 => $2; /(.+):(.+)/; } (split /;/, $Elm));
is something that I don't understand!!
This initial warning disappeares if you either remove
/(.+):(.+)/;
or
$1 => $2;
or if you have a seperate function for those two:
sub _split { /(.+):(.+)/; return ($1 => $2) if ($1); }
so that the line 120 looks like
%E = (map { _split($_) } (split /;/, $Elm));


Finally I have to tell you that there is a really, really stupid bug, after the loop of the Writer. This code

$Elm =''; # to rewrite $E foreach ( split /;/, $Elm ) { $Elm .= "$_;" unless ( $_ =~ /^$ID\:/); } cond_broadcast($Elm);
has to be changed into:
my $tmp = ''; foreach ( split /;/, $Elm ) { $tmp .= "$_;" if ( $_ !~ /^$ID\:/ && $_ =~/:/); } $Elm = $tmp; cond_broadcast($Elm);
I think, now everything is ok,
'it can be braodcasted'
Carl

In reply to Re: Re: thread:shared by Anonymous Monk
in thread thread:shared by Anonymous Monk

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.