3 binmode(STDOUT, ":utf8");
13 $ua = LWP::UserAgent->new;
14 $ua->agent("tel2name/1.0 ");
15 $res = $ua->request(HTTP::Request->new("GET", "http://www.eniro.se/query?what=yp&search_word=$tel"));
17 return undef unless $res->is_success;
19 $html = $res->content;
21 match: while($html =~ /<span\s+class\s*=\s*"org fn"\s*>\s*([^<]*[^\s<])\s*<\/span>/ig) {
22 $match = decode_entities($1);
23 for $prev (@matches) {
24 next match if $prev eq $match;
26 push @matches, $match;
35 $ua = LWP::UserAgent->new;
36 $ua->agent("tel2name/1.0 ");
37 $res = $ua->request(HTTP::Request->new("GET", "http://www.eniro.se/query?what=wp&phone_number=$tel"));
39 return undef unless $res->is_success;
41 $html = $res->content;
43 match: while($html =~ /<a\s+class\s*=\s*"fn expand"[^>]*>\s*\<span\>\s*([^<]*[^\s<])\s*<\/span>/ig) {
44 $match = decode_entities($1);
45 for $prev (@matches) {
46 next match if $prev eq $match;
48 push @matches, $match;
55 if(open NT, $ENV{"HOME"} . "/phone/nametab") {
65 $yppid = open YP, "-|";
69 if(@matches = yplookup $tel) {
70 for $match (@matches) {
72 print " ($tel)" if $mod;
77 last bt if !($tel =~ /(.+)[^0](0*)$/);
83 $wppid = open WP, "-|";
85 for $match (wplookup $tel) {
95 for $prev (@matches) {
96 next match if $prev eq $_;
102 for $prev (@matches) {
103 next match if $prev eq $_;
108 for $match (@matches) {