|
NAMEPOE::Component::Client::DNS - non-blocking, parallel DNS clientVERSIONversion 1.054SYNOPSISuse POE qw(Component::Client::DNS); my $named = POE::Component::Client::DNS->spawn( Alias => "named" ); POE::Session->create( inline_states => { _start => \&start_tests, response => \&got_response, } ); POE::Kernel->run(); exit; sub start_tests { my $response = $named->resolve( event => "response", host => "localhost", context => { }, ); if ($response) { $_[KERNEL]->yield(response => $response); } } sub got_response { my $response = $_[ARG0]; my @answers = $response->{response}->answer(); foreach my $answer (@answers) { print( "$response->{host} = ", $answer->type(), " ", $answer->rdatastr(), "\n" ); } } DESCRIPTIONPOE::Component::Client::DNS provides non-blocking, parallel DNS requests via Net::DNS. Using POE, it allows other tasks to run while waiting for name servers to respond.For simple name resolution, including smart handling of IPv6 names, please see POE::Component::Resolver instead. PUBLIC METHODS
RESPONSE MESSAGESPOE::Component::Client::DNS responds in one of two ways. Its resolve() method will return a response immediately if it can be found in the component's cache. Otherwise the component posts the response back in $_[ARG0]. In either case, the response is a hash reference containing the same fields:host => $request_host, type => $request_type, class => $request_class, context => $request_context, response => $net_dns_packet, error => $net_dns_error, The "host", "type", "class", and "context" response fields are identical to those given in the request message. "response" contains a Net::DNS::Packet object on success or undef if the lookup failed. The Net::DNS::Packet object describes the response to the program's request. It may contain several DNS records. Please consult Net::DNS and Net::DNS::Packet for more information. "error" contains a description of any error that has occurred. It is only valid if "response" is undefined. SEE ALSOPOE - POE::Component::Client::DNS builds heavily on POE.POE::Component::Resolver - A system name resolver, including IPv6 support and whatever else your system supports. Net::DNS - This module uses Net::DNS internally. Net::DNS::Packet - Responses are returned as Net::DNS::Packet objects. DEPRECATIONSThe older, list-based interfaces are no longer documented as of version 0.98. They are being phased out. The method-based interface, first implementedin version 0.98, will replace the deprecated interfaces after a six-month phase-out period.Version 0.98 was released in October of 2004. The deprecated interfaces will continue to work without warnings until January 2005. As of January 2005, programs that use the deprecated interfaces will continue to work, but they will generate mandatory warnings. Those warnings will persist until April 2005. As of April 2005 the mandatory warnings will be upgraded to mandatory errors. Support for the deprecated interfaces will be removed entirely. As of late January 2011, POE::Component::Resolver provides basic system resolver support, including IPv6 and mDNS if your resolver's configured ot use it. The use of POE::Component::Client::DNS for basic resolution is deprecated, however it's still the best option for actual DNS server requests. BUG TRACKERhttps://rt.cpan.org/Dist/Display.html?Queue=POE-Component-Client-DNSREPOSITORYhttp://github.com/rcaputo/poe-component-client-dnsOTHER RESOURCEShttp://search.cpan.org/dist/POE-Component-Client-DNS/AUTHOR & COPYRIGHTSPOE::Component::Client::DNS is Copyright 1999-2009 by Rocco Caputo. All rights are reserved. POE::Component::Client::DNS is free software; you may redistribute it and/or modify it under the same terms as Perl itself.Postback arguments were contributed by tag.
Visit the GSP FreeBSD Man Page Interface. |