Skip to content

Commit

Permalink
bugs
Browse files Browse the repository at this point in the history
  • Loading branch information
jettero committed Jun 7, 2011
1 parent 66fcb65 commit 1ee9b27
Showing 1 changed file with 15 additions and 1 deletion.
16 changes: 15 additions & 1 deletion t/45_stats.t
Expand Up @@ -15,16 +15,30 @@ if( -s "device" ) {

unless( $dev ) {
warn " [skipping tests: no device given]\n";
UGH_DIE:
skip(1, 0,0) for 1 .. $max;
exit 0;
}

my $npe = Net::Pcap::Easy->new(
my $npe;
unless(
eval {
$npe = Net::Pcap::Easy->new(
dev => $dev,
promiscuous => 1,
packets_per_loop => 1,
default_callback => sub {},
);
}) {
if( $@ =~ m/(?:permission|permitted)/i ) {
warn " [skipping tests: permission denied, try running as root]\n";

} else {
warn "couldn't open $dev: $@";
}

goto UGH_DIE;
}

$npe->loop;

Expand Down

0 comments on commit 1ee9b27

Please sign in to comment.