The result of the search() is a Net::DNS::Packet object. The script uses the answer() method against this object to retrieve each matching RR, as the code in callout D shows. Each RR is in the form of a Net::DNS::RR object for the specific record type.
Each RR type has a module under Net::DNS::RR (i.e., Net::DNS::RR::
RecordType) that implements that RR type's methods. You can use these methods to retrieve the data available for that RR type. For example, you can use the Net::DNS::RR::SRV module's target() method to find the name of the host that matches the SRV record.
The script in Web Listing 1 (http://www.winscriptingsolutions.com, InstantDoc ID 26630), is similar to that in Listing 1 except that the query is for the _ldap._tcp.gc._msdcs.ForestName SRV record, which returns all GC servers in the ForestName forest. Because GC servers are forestwide, not specific to a domain, Web Listing 1 queries ForestName instead of querying DomainName as Listing 1 does. Another difference is that for each matching host, Web Listing 1 performs a second queryagainst the A record to determine the host's IP address. . . .