POE::Component::IRC::Plugin::QueryDNS - A POE::Component::IRC plugin for
    IRC based DNS queries

    version 1.04

      use strict;
      use warnings;
      use POE qw(Component::IRC Component::IRC::Plugin::QueryDNS);

      my $nickname = 'qdns' . $$;
      my $ircname = 'QueryDNS Bot';
      my $ircserver = $ENV{IRCSERVER} || '';
      my $port = 6667;
      my $channel = '';

      my $irc = POE::Component::IRC->spawn(
            nick => $nickname,
            server => $ircserver,
            port => $port,
            ircname => $ircname,
            debug => 0,
            plugin_debug => 1,
            options => { trace => 0 },
      ) or die "Oh noooo! $!";

            package_states => [
                    'main' => [ qw(_start irc_001) ],

      exit 0;

      sub _start {
        # Create and load our QueryDNS plugin
        $irc->plugin_add( 'QueryDNS' =>
            POE::Component::IRC::Plugin::QueryDNS->new() );

        $irc->yield( register => 'all' );
        $irc->yield( connect => { } );

      sub irc_001 {
        $irc->yield( join => $channel );

    POE::Component::IRC::Plugin::QueryDNS is a POE::Component::IRC plugin
    that provides DNS query facilities to the channels it occupies and via
    private messaging.

    It uses POE::Component::Client::DNS to do non-blocking DNS queries. By
    default the plugin attempts to use POE::Component::IRC's internal
    PoCo-Client-DNS resolver object, but will spawn its own copy. You can
    supply your own resolver object via the constructor.

        Creates a new plugin object. Takes some optional parameter:

          'command', define the command that will trigger DNS queries, default is 'dns';
          'privmsg', set to a true value to specify that the bot should reply with PRIVMSG instead of
                     NOTICE to privmsgs that it receives.
          'resolver', specify a POE::Component::Client::DNS object that the plugin should use,
                      the default is to try and use POE::Component::IRC's resolver;

    The bot replies to requests in the following form, when addressed:

      dns <query> <optional_type>

    Of course, if you changed the "command" in the constructor it will be
    something different to "dns".

    "query" maybe a hostname, a zone, an IP address, anything that you want
    to query DNS for.

    "type" can be "A", "PTR", "CNAME", "NS", "MX", "TXT", "AAAA", "SRV" or
    "SOA". If it isn't specified the default is "A" unless the "query" is an
    IP address in which case the default is "PTR".

    Some examples:

       # No type, defaults to 'A'
       < you> bot: dns
       < bot> [ A= ]

       # No type, defaults to 'PTR' because the query is an IP address
       < you> bot: dns
       < bot> [ ]

       # Specify a type of 'MX'
       < you> bot: dns mx
       < bot> [ MX=5 ]

       # Specify a type of 'TXT'
       < you> bot: dns txt
       < bot> No answers for

       # Specify a type of 'SOA'
       < you> bot: dns soa
       < bot> [ ]


    Chris Williams <>

    This software is copyright (c) 2011 by Chris Williams.

    This is free software; you can redistribute it and/or modify it under
    the same terms as the Perl 5 programming language system itself.