| 1 | package Bot::BasicBot::Pluggable::Module::Whois; | ||||||||||||
| 2 | |||||||||||||
| 3 | 1 | ▶ | use strict; | ||||||||||
|
Subroutine
BEGIN: called CC=1 SCAR=0.0
| |||||||||||||
| 4 | 1 | ▶ | use Bot::BasicBot::Pluggable::Module; | ||||||||||
|
Subroutine
BEGIN: called CC=1 SCAR=0.0
| |||||||||||||
| 5 | 1 | ▶ | use base qw(Bot::BasicBot::Pluggable::Module); | ||||||||||
|
Subroutine
BEGIN: called CC=1 SCAR=0.0
| |||||||||||||
| 6 | |||||||||||||
| 7 | 1 | ▶ | use Net::Whois; | ||||||||||
|
Subroutine
BEGIN: called CC=1 SCAR=0.0
| |||||||||||||
| 8 | |||||||||||||
| 9 | 0 | ▶ | sub said { | ||||||||||
|
Subroutine
said: not called CC=6 SCAR=37.4
Pod
documented
| |||||||||||||
| 10 | 0 | my ($self, $mess, $pri) = @_; | |||||||||||
| 11 | |||||||||||||
| 12 | 0 | my $body = $mess->{body}; | |||||||||||
| 13 | 0 | my $who = $mess->{who}; | |||||||||||
| 14 | |||||||||||||
| 15 | 0 | ▶ | return unless ($pri == 2); | ||||||||||
|
Branch: 1 branch
| |||||||||||||
| 16 | |||||||||||||
| 17 | 0 | ▶ | return unless $body =~ /^(whois|internic|ripe)(?: for)?\s+(\S+)$/i; | ||||||||||
|
Branch: 1 branch
| |||||||||||||
| 18 | |||||||||||||
| 19 | 0 | my $where = $1; | |||||||||||
| 20 | 0 | my $what = $2; | |||||||||||
| 21 | |||||||||||||
| 22 | 0 | ▶ | my $w = Net::Whois::Domain->new($what) || return "Can't connect to the WHOIS server"; | ||||||||||
|
Condition0%0/2
'Net::Whois::Domain'->new($what) || (return q[Can't connect to the WHOIS server])
MC/DC0%0/1
'Net::Whois::Domain'->new($what) || (return q[Can't connect to the WHOIS server])
'Net::Whois::Domain'->new($what)
Truth table0%0/2
A
A= 'Net::Whois::Domain'->new($what)
| |||||||||||||
| 23 | |||||||||||||
| 24 | 0 | ▶ | return "No match for $what" unless $w->ok; | ||||||||||
|
Branch: 1 branch
| |||||||||||||
| 25 | |||||||||||||
| 26 | 0 | my $address = join "", map { "$_, " } $w->address; | |||||||||||
| 27 | 0 | ▶ | my $ns = join "", map { my $name = $$_[0]; my $ip = $$_[1] || " "; "$name ($ip), " } @{$w->servers}; | ||||||||||
|
Condition0%0/2
$_->[1] || ' '
MC/DC0%0/1
$_->[1] || ' '
$_->[1]
Truth table0%0/2
A
A= $_->[1]
| |||||||||||||
| 28 | |||||||||||||
| 29 | 0 | my $response = ""; | |||||||||||
| 30 | 0 | $response .= "Domain: ". $w->domain. " "; | |||||||||||
| 31 | 0 | $response .= "Name: ". $w->name. " "; | |||||||||||
| 32 | 0 | $response .= "Tag: ". $w->tag. " "; | |||||||||||
| 33 | 0 | $response .= "Address: $address "; | |||||||||||
| 34 | 0 | $response .= "Country: ". $w->country. " "; | |||||||||||
| 35 | 0 | $response .= "Name Servers: $ns"; | |||||||||||
| 36 | |||||||||||||
| 37 | 0 | return $response; | |||||||||||
| 38 | |||||||||||||
| 39 | |||||||||||||
| 40 | |||||||||||||
| 41 | } | ||||||||||||
| 42 | |||||||||||||
| 43 | 0 | ▶ | sub help { | ||||||||||
|
Subroutine
help: not called CC=1 SCAR=6.9
Pod
documented
| |||||||||||||
| 44 | 0 | return "Commands: '(whois|internic|ripe) fo <host>'"; | |||||||||||
| 45 | } | ||||||||||||
| 46 | |||||||||||||
| 47 | 1 | 1; | |||||||||||
| 48 | |||||||||||||
| 49 | =head1 NAME | ||||||||||||
| 50 | |||||||||||||
| 51 | Bot::BasicBot::Pluggable::Module::Whois - look up Internic/RIPE whois records for a host | ||||||||||||
| 52 | |||||||||||||
| 53 | |||||||||||||
| 54 | =head1 SYNOPSIS | ||||||||||||
| 55 | |||||||||||||
| 56 | Queries RIPE or the Internic for the whois information about the | ||||||||||||
| 57 | supplied host, and formats it up nicely. | ||||||||||||
| 58 | |||||||||||||
| 59 | |||||||||||||
| 60 | =head1 IRC USAGE | ||||||||||||
| 61 | |||||||||||||
| 62 | Internic|RIPE for <host> | ||||||||||||
| 63 | |||||||||||||
| 64 | =head1 AUTHOR | ||||||||||||
| 65 | |||||||||||||
| 66 | Simon Wistow, <simon@thegestalt.org> | ||||||||||||
| 67 | |||||||||||||
| 68 | =head1 COPYRIGHT | ||||||||||||
| 69 | |||||||||||||
| 70 | Copyright 2005, Simon Wistow | ||||||||||||
| 71 | |||||||||||||
| 72 | Distributed under the same terms as Perl itself. | ||||||||||||
| 73 | |||||||||||||
| 74 | =head1 SEE ALSO | ||||||||||||
| 75 | |||||||||||||
| 76 | |||||||||||||
| 77 | =cut | ||||||||||||
| 78 | |||||||||||||