Fellow monks, I've just started using Net::Pcap. I read the tutorial and the CPAN documentation. My syntax and usage of the lookupdev() and findalldevs() methods seems normal. However, when I run this script under linux, my script does not find any devices! At the same time, the exact same script running in Windows works just fine (except that lib_version() method seems to not be implemented). I can't help but wonder if this has anything to do with the pcap library on my linux installation (version 0.9.1). Does anyone have any ideas?

use strict; use Net::Pcap; $|++; my $err; print "pcap version " . Net::Pcap::lib_version() . "\n"; my %devinfo; my @devs = Net::Pcap::findalldevs(\$err, \%devinfo); if (defined $err) { die 'Unable to determine network device for monitoring - ', $err; } my $choice; do { print "Please choose a device to monitor:\n"; my $i = 0; for my $dev (@devs) { print ++$i . " - $dev : $devinfo{$dev}\n" } print "Choice: "; $choice = <>; } while ($choice<1 or $choice>scalar(@devs));

In reply to Net::Pcap lookupdev problem by gri6507

Title:
Use:  <p> text here (a paragraph) </p>
and:  <code> code here </code>
to format your post, it's "PerlMonks-approved HTML":



  • Posts are HTML formatted. Put <p> </p> tags around your paragraphs. Put <code> </code> tags around your code and data!
  • Titles consisting of a single word are discouraged, and in most cases are disallowed outright.
  • Read Where should I post X? if you're not absolutely sure you're posting in the right place.
  • Please read these before you post! —
  • Posts may use any of the Perl Monks Approved HTML tags:
    a, abbr, b, big, blockquote, br, caption, center, col, colgroup, dd, del, details, div, dl, dt, em, font, h1, h2, h3, h4, h5, h6, hr, i, ins, li, ol, p, pre, readmore, small, span, spoiler, strike, strong, sub, summary, sup, table, tbody, td, tfoot, th, thead, tr, tt, u, ul, wbr
  • You may need to use entities for some characters, as follows. (Exception: Within code tags, you can put the characters literally.)
            For:     Use:
    & &amp;
    < &lt;
    > &gt;
    [ &#91;
    ] &#93;
  • Link using PerlMonks shortcuts! What shortcuts can I use for linking?
  • See Writeup Formatting Tips and other pages linked from there for more info.