VoLAnD has asked for the wisdom of the Perl Monks concerning the following question:

Need to check is user, for example 'John' is online. Trying $conn->whois('John'); but not understand how it works.
  • Comment on Net::IRC - how to check is user online?

Replies are listed 'Best First'.
Re: Net::IRC - how to check is user online?
by kyle (Abbot) on Jun 08, 2007 at 14:43 UTC

    I haven't used Net::IRC, but from my quick look through the documentation, it looks as if it's all event-based, like a lot of IRC software I've seen. Given that, what you'll need to do is set up an event handler for when your 'whois' command returns before sending the command. The sequence will go something like this:

    1. You create and register an event handler.
    2. You send your 'whois' command.
    3. The server responds, and Net::IRC calls the handler that you registered.
    4. The handler can then look at the response and do something useful.

    I don't know for sure, but I wouldn't be surprised if there are separate types of events for when a user is online and when the server responds that there's nobody here by that nick.

A reply falls below the community's threshold of quality. You may see it by logging in.