in reply to Re^2: Perl Simple IRC Client question
in thread Perl Simple IRC Client question

You should really use some of the IRC modules instead of writing this yourself. For example if the remote server is very slow (or throttles you), your attempt of blockingly printing a whole line in one go will stall your whole client even if it's just one server that is slow.

But anyway, see print about how to print to any expression more complex than a simple scalar.

Replies are listed 'Best First'.
Re^4: Perl Simple IRC Client question
by Anonymous Monk on Feb 19, 2010 at 17:06 UTC
    Ok I've decided to use BasicBot, sorry but I have one more question. I'm trying to override the said subroutine, but failing miserably. I've been googling if there is any special syntax besides writing a sub said { } after the declaration, but it's still using the default subroutine..
      Sorry I wasn't logged in. Here's the code:
      #!/bin/perl -w use strict; use Bot::BasicBot; my $bot = Bot::BasicBot->new( server => "ircserver", port => "6697", ssl => "true", channels => ["#testing123"], nick => "mlapaglia", alt_nicks => ["bbot", "simplebot"], username => "mlapaglia", name => "mlapaglia", ); $bot->run(); sub said { print "ahhh\n"; }

        You're supposed to override methods in Bot::BasicBot:

        package Bot::Mlapaglia; use strict; use parent 'Bot::BasicBot'; sub said { my ($self, $args) = @_; return "That's what she said. Heh heh."; }; package main; my $bot = Bit::Mlapaglia->new( ... ); $bot->run();