| Bot-BasicBot-Pluggable-Module-Network documentation | Contained in the Bot-BasicBot-Pluggable-Module-Network distribution. |
Bot::BasicBot::Pluggable::Module::Traceroute - do a traceroute for a host
traceroute <host>
Simon Wistow, <simon@thegestalt.org>
Copyright 2005, Simon Wistow
Distributed under the same terms as Perl itself.
| Bot-BasicBot-Pluggable-Module-Network documentation | Contained in the Bot-BasicBot-Pluggable-Module-Network distribution. |
package Bot::BasicBot::Pluggable::Module::Traceroute; use strict; use Bot::BasicBot::Pluggable::Module; use base qw(Bot::BasicBot::Pluggable::Module); use Net::Traceroute; sub said { my ($self, $mess, $pri) = @_; my $body = $mess->{body}; my $who = $mess->{who}; return unless ($pri == 2); return unless $body =~ m!\s*traceroute\s+([\w\.]+)!; my $host = $1; my $t; eval { $t = Net::Traceroute->new( host => $host ) }; return "Hrmm, couldn't traceroute to $host - $@" if $@; return "Hrmm, couldn't traceroute to $host cos I can't find it" if !$t->found; return $t->hop_query_host($t->hops,0); } sub help { return "Commands: 'traceroute <host>"; } 1;