in reply to Re^2: IRC Client not Joining Channel
in thread IRC Client not Joining Channel
First, I recommend changing:#-------------------Watch for IRC Inputs------------------- sub incoming_data { my ( $fd, $condition, $fh ) = @_; print "its going\n"; if ( $condition eq 'in' ) { my $input; sysread $fh, $input, 1000000; #chop $input; $input =~ s/\r\n//g; my $hashref = $parser->parse( $input ); SWITCH: { my $type = lc $hashref->{command}; my @args; push @args, $hashref->{prefix} if $hashref->{prefix}; push @args, @{ $hashref->{params} }; if ( defined $dispatch{$type} ) { $dispatch{$type}->(@args); last SWITCH; } print STDOUT join( ' ', "irc_$type:", @args ), "\n"; } } return 1; }
to:sysread $fh, $input, 1000000; #chop $input; $input =~ s/\r\n//g;
You can put a loop in there if you want to handle more than one line at a time. What you are doing mushes everything together and makes it unparseable.$input = <$fh>; chomp $input;
|
|---|
| Replies are listed 'Best First'. | |
|---|---|
|
Re^4: IRC Client not Joining Channel
by deadpickle (Pilgrim) on Mar 04, 2008 at 19:47 UTC |