Developer Area

root/apps/perl/trunk/lookup/recurse.pl

Revision 318, 0.9 kB (checked in by henri, 5 years ago)

Import of lookup sample directory

  • Property svn:mime-type set to text/plain
  • Property svn:eol-style set to native
  • Property svn:executable set to *
  • Property svn:keywords set to Date Revision Author HeadURL Id
Line 
1# sample script that recurses through Non-Terminal NAPTR records
2# Author: Henri Asseily < henri.tel >
3
4use lib 'lib';  # uses a locally modified version of Net::Lookup::DotTel 0.1
5use Net::Lookup::DotTel;
6
7our $maxdepth = 5; # don't go deeper than this in subdomains
8our $currdepth = 0;
9
10sub lookmeup {
11  $currdepth++;
12  return if ($currdepth >= $maxdepth);
13  my $domain = shift || return;
14  warn "Entering domain: $domain\n";
15  my $lookup = Net::Lookup::DotTel->new;
16
17  if ( $lookup->lookup ( $domain )) {
18   my @s = $lookup->get_services;
19   foreach my $s (@s) {
20     if ($s->{flags} eq '') { # non-terminal, recurse down
21      &lookmeup($s->{replacement});
22     } else {
23      # Here we've got terminal records
24     if ( $s->{uri} =~ /^mailto:(.+)/ ) {
25        my $email = $1;
26        warn "Found email: $email\n";
27       }
28     }
29    }
30  }
31  $currdepth--;
32} # sub lookmeup
33
34my $d = shift || die "Usage: $0 domain.tel\n";
35&lookmeup($d);
Note: See TracBrowser for help on using the browser.
Telnic
Search This Site
Partners
Neustar
ICANN
Main site | WHOIS | Sell .tel | FAQ | Archived Site | About Telnic | Contact Us