| 1 | package Bot::BasicBot::Pluggable::Module::Traceroute; | ||||||||||
| 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::Traceroute; | ||||||||
|
Subroutine
BEGIN: called CC=1 SCAR=0.0
| |||||||||||
| 8 | |||||||||||
| 9 | 0 | ▶ | sub said { | ||||||||
|
Subroutine
said: not called CC=5 SCAR=34.0
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 | 0 | ▶ | return unless $body =~ m!\s*traceroute\s+([\w\.]+)!; | ||||||||
|
Branch: 1 branch
| |||||||||||
| 17 | |||||||||||
| 18 | 0 | my $host = $1; | |||||||||
| 19 | |||||||||||
| 20 | |||||||||||
| 21 | 0 | my $t; | |||||||||
| 22 | 0 | eval { $t = Net::Traceroute->new( host => $host ) }; | |||||||||
| 23 | |||||||||||
| 24 | 0 | ▶ | return "Hrmm, couldn't traceroute to $host - $@" if $@; | ||||||||
|
Branch: 1 branch
| |||||||||||
| 25 | 0 | ▶ | return "Hrmm, couldn't traceroute to $host cos I can't find it" if !$t->found; | ||||||||
|
Branch: 1 branch
| |||||||||||
| 26 | |||||||||||
| 27 | 0 | return $t->hop_query_host($t->hops,0); | |||||||||
| 28 | } | ||||||||||
| 29 | |||||||||||
| 30 | 0 | ▶ | sub help { | ||||||||
|
Subroutine
help: not called CC=1 SCAR=6.9
Pod
documented
| |||||||||||
| 31 | 0 | return "Commands: 'traceroute <host>"; | |||||||||
| 32 | } | ||||||||||
| 33 | |||||||||||
| 34 | 1 | 1; | |||||||||
| 35 | |||||||||||
| 36 | =head1 NAME | ||||||||||
| 37 | |||||||||||
| 38 | Bot::BasicBot::Pluggable::Module::Traceroute - do a traceroute for a host | ||||||||||
| 39 | |||||||||||
| 40 | =head1 IRC USAGE | ||||||||||
| 41 | |||||||||||
| 42 | traceroute <host> | ||||||||||
| 43 | |||||||||||
| 44 | =head1 AUTHOR | ||||||||||
| 45 | |||||||||||
| 46 | Simon Wistow, <simon@thegestalt.org> | ||||||||||
| 47 | |||||||||||
| 48 | =head1 COPYRIGHT | ||||||||||
| 49 | |||||||||||
| 50 | Copyright 2005, Simon Wistow | ||||||||||
| 51 | |||||||||||
| 52 | Distributed under the same terms as Perl itself. | ||||||||||
| 53 | |||||||||||
| 54 | =head1 SEE ALSO | ||||||||||
| 55 | |||||||||||
| 56 | |||||||||||
| 57 | =cut | ||||||||||
| 58 | |||||||||||