in reply to Small net::irc questions

1) The NET::IRC folks don't seem to have gotten around to it yet, but eventually this information should be in the docs for NET::IRC::Connection. For the moment your answers can only be found in the source...

More specifically, a PRIVMSG is just that, a PRIVMSG to either a channel or a specific nick. If you really want to dive into it I would suggest the good ol' RFC 1459.

Now as for your actual question(yes, yes, I will answer it :)), from the source of NET::IRC::Connection :

# Change channel and user modes (this one is easy... the handler is a +bitch.) # Takes at least 1 arg: the target of the command (channel or nick) # (optional) the mode string (i.e., "-boo+i") # (optional) operands of the mode string (nicks, hostmask +s, etc.) sub mode { my $self = shift; unless (@_ >= 1) { croak "Not enough arguments to mode()"; } $self->sl("MODE $_[0] " . CORE::join(" ", @_[1..$#_])); }
So the answer would be: $conn->mode('#channel', '+v', 'nickname');

2) $irc->start() permanently yields control to the module. Like it says in the docs for NET::IRC:

Getting Connected

When you've set up all your handlers, the following command will put your program in an infinite loop, grabbing input from all open connections and passing it off to the proper handlers:

$irc->start;

Note that new connections can be added and old ones dropped from within your handlers even after you call this. Just don't expect any code below the call to start() to ever get executed.

If you're tying Net::IRC into another event-based module, such as perl/Tk, there's a nifty do_one_loop() method provided for your convenience. Calling $irc->do_one_loop() runs through the IRC.pm event loop once, hands all ready filehandles over to the appropriate handler subs, then returns control to your program.

There you have it, hope that helps you get underway :-)

Remember rule one...

Replies are listed 'Best First'.
Re^2: Small net::irc questions
by coldfingertips (Pilgrim) on May 03, 2005 at 17:00 UTC
    Thanks for yoru help, I really appreciate.

    After trying $conn->mode("$channel", '+v', "$nickname") as you suggested, it had the same results as printing it as a prvmsg. It prints /#channel name +v UserName .

    I went back and changed use Net::IRC to use Net::IRC::Connection thinking this was the solution. Doing this created an error "Can't locate object new..". So from that, I went ahead and changed my $irc = new Net::IRC; to my $irc = new Net::IRC::Connection; and it errors out with "No method called "newconn" for object.". Any idea what's going wrong or why it's printing as text?

    Thanks! I haven't tried the loop thing yet, I'm still trying to get the commands to work.