github
Advanced Search
  • Home
  • Pricing and Signup
  • Explore GitHub
  • Blog
  • Login

bingos / poe-component-client-dnsbl

  • Admin
  • Watch Unwatch
  • Fork
  • Your Fork
  • Pull Request
  • Download Source
    • 1
    • 0
  • Source
  • Commits
  • Network (0)
  • Issues (0)
  • Downloads (2)
  • Wiki (1)
  • Graphs
  • Branch: master

click here to add a description

click here to add a homepage

  • Branches (1)
    • master ✓
  • Tags (2)
    • 1.02
    • 1.00
Sending Request…
Enable Donations

Pledgie Donations

Once activated, we'll place the following badge in your repository's detail box:
Pledgie_example
This service is courtesy of Pledgie.

(perl) A POE component that provides non-blocking DNSBL lookups — Read more

  cancel

http://search.cpan.org/dist/POE-Component-Client-DNSBL/

  cancel
  • Private
  • Read-Only
  • HTTP Read-Only

This URL has Read+Write access

Added postback functionality 
Chris Williams (author)
Tue May 19 02:35:28 -0700 2009
commit  4c0371221384119eea0ed365dd2a9437a2876e40
tree    2d1c054fcf4287edb52f23d1fbadd10952e9f88f
parent  a989bfa58bdcadda4d030f79a7b7c5199e395d31
poe-component-client-dnsbl /
name age
history
message
file Changes Loading commit data...
file MANIFEST
file Makefile.PL
file README
directory examples/
directory lib/
directory t/
README
NAME
    POE::Component::Client::DNSBL - A component that provides non-blocking
    DNSBL lookups

SYNOPSIS
      use 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;
      }

DESCRIPTION
    POE::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 are supported and unless a DNSBL zone is specified the
    component will use zen.spamhaus.org.

CONSTRUCTOR
    spawn
        Takes a number of parameters:

          'alias', set an alias that you can use to address the component later;
          'options', a hashref of POE session options;
          'dnsbl', the DNSBL zone to send queries to, default zen.spamhaus.org;
          'resolver', optionally provide a POE::Component::Client::DNS to use;

        Returns an object.

METHODS
    session_id
        Takes no arguments. Returns the ID of the component's session.

    shutdown
        Terminates the component.

    lookup
        Performs a DNSBL lookup. Takes a number of parameters:

          'event', the name of the event to send the reply to. ( Mandatory );
          'address', the IPv4 address to lookup ( Mandatory );
          'session', send the resultant event to an alternative session, ( default is the sender );

        You may also pass arbitary key/values. Arbitary keys should have an
        underscore prefix '_'.

INPUT EVENTS
    shutdown
        Terminates the component.

    lookup
        Performs a DNSBL lookup. Takes a number of parameters:

          'event', the name of the event to send the reply to. ( Mandatory );
          'address', the IPv4 address to lookup ( Mandatory );
          'session', send the resultant event to an alternative session, ( default is the sender );

        You may also pass arbitary key/values. Arbitary keys should have an
        underscore prefix '_'.

OUTPUT EVENTS
    The 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 ).

      '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;

AUTHOR
    Chris "BinGOs" Williams <chris@bingosnet.co.uk>

SEE ALSO
    <http://en.wikipedia.org/wiki/DNSBL>

    <http://www.spamhaus.org/zen/>

    POE

    POE::Component::Client::DNS

Blog | Support | Training | Contact | API | Status | Twitter | Help | Security
© 2010 GitHub Inc. All rights reserved. | Terms of Service | Privacy Policy
Powered by the Dedicated Servers and
Cloud Computing of Rackspace Hosting®
Dedicated Server