in reply to Re^2: IRC Client not Joining Channel
in thread IRC Client not Joining Channel
I recommend cutting out all the extra code next time, it is very distracting from the actual problem.
So here is the code that you say appears to be bad
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;
In Section
Seekers of Perl Wisdom