use strict; my $server = new MyMonitor( 8000 ); run $server; exit 0; package MyMonitor; use strict; use Net::Server; use base qw(Net::Server); 1; sub run { my $this = shift; $this->SUPER::run( port => $this->{port}, proto => $this->{proto} ); } sub new { my $class = shift; my $this = bless {}, $class; $this->{port} = shift || 3000; $this->{proto} = shift || 'tcp'; return $this; } sub process_request { my $this = shift; my $prop = $this->{server}; open IN, "/proc/net/dev" or die "problem opening procnetdev: $!"; if( $prop->{udp_true} ){ $prop->{client}->send($_, 0) while ; close IN; return; } print $_ while ; close IN; }