|
NAMEPOE::Component::Client::DNSBL - A component that provides non-blocking DNSBL lookupsVERSIONversion 1.08SYNOPSISuse strict; use POE qw(Component::Client::DNSBL); die "Please provide at least one IP address to lookup\n" unless scalar @ARGV; my $dnsbl = POE::Component::Client::DNSBL->spawn(); POE::Session->create( package_states => [ 'main' => [ qw(_start _stop _response) ], ], heap => { addresses => [ @ARGV ], dnsbl => $dnsbl }, ); $poe_kernel->run(); exit 0; sub _start { my ($kernel,$heap) = @_[KERNEL,HEAP]; $heap->{dnsbl}->lookup( event => '_response', address => $_, ) for @{ $heap->{addresses} }; return; } sub _stop { my ($kernel,$heap) = @_[KERNEL,HEAP]; $kernel->call( $heap->{dnsbl}->session_id(), 'shutdown' ); return; } sub _response { my ($kernel,$heap,$record) = @_[KERNEL,HEAP,ARG0]; if ( $record->{error} ) { print "An error occurred, ", $record->{error}, "\n"; return; } if ( $record->{response} eq 'NXDOMAIN' ) { print $record->{address}, " is okay\n"; return; } print join( " ", $record->{address}, $record->{response}, $record->{reason} ), "\n"; return; } DESCRIPTIONPOE::Component::Client::DNSBL is a POE component that provides non-blocking DNS blacklist lookups to other components and POE sessions. It uses POE::Component::Client::DNS to perform the requested queries.Only IPv4 lookups and URI/RHS lookups are supported and unless a DNSBL zone is specified the component will use zen.spamhaus.org. CONSTRUCTOR
METHODS
INPUT EVENTS
OUTPUT EVENTSThe component will send an event in response to "lookup" requests. "ARG0" will be a hashref containing the key/values of the original request ( including any arbitary key/values passed ).If a POE::Session postback was specified, then the hashref will be the first parameter of the arrayref given as "ARG1" 'response', the status returned by the DNSBL, it will be NXDOMAIN if the address given was okay; 'reason', if an address is blacklisted, this may contain the reason; 'error', if something goes wrong with the DNS lookup the error string will be contained here; 'dnsbl', the DNSBL that was used for this request; AUTHORChris "BinGOs" Williams <chris@bingosnet.co.uk>LICENSECopyright © Chris Williamss.This module may be used, modified, and distributed under the same terms as Perl itself. Please see the license that came with your Perl distribution for details. SEE ALSO<http://en.wikipedia.org/wiki/DNSBL><http://www.spamhaus.org/zen/> <http://www.spamhaus.org/dbl/> POE POE::Session POE::Component::Client::DNS AUTHORChris Williams <chris@bingosnet.co.uk>COPYRIGHT AND LICENSEThis 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.
Visit the GSP FreeBSD Man Page Interface. |