If your purpose is only to log the output of traceroute, then you should follow LameNerd's suggestion. If you need also to parse the logged output, then using Net::Traceroute is a simpler solution. It is currently implemented as a parser around the system traceroute command and produces informations that can be easily accessed. For example:
#!/usr/bin/perl use strict; use warnings; use Net::Traceroute; my $tr = Net::Traceroute->new( host => 'www.students.cs.unibo.it', queries => 1); if ($tr->found) { my $hops = $tr->hops; foreach (1..$hops) { printf("%02d: %-15s %d %.3f ms\n", $_, $tr->hop_query_host($_, 1), $tr->hop_query_stat($_, 1), $tr->hop_query_time($_, 1)); } }
Given this sample code, it should fairly easy to do whatever you want with the retrieved data.
Ciao, Valerio
In reply to Re: Log Traceroute
by valdez
in thread Log Traceroute
by mkirank
| For: | Use: | ||
| & | & | ||
| < | < | ||
| > | > | ||
| [ | [ | ||
| ] | ] |