in reply to "Undefined subroutine &main::pcap_lookupdev called" yet module installed and PERL5LIB is set correctly : *(

The Synopsis is misleading. Net::Pcap only exports some constants by default, no functions. Try

use Net::Pcap qw( :functions );
  • Comment on Re: "Undefined subroutine &main::pcap_lookupdev called" yet module installed and PERL5LIB is set correctly : *(
  • Download Code

Replies are listed 'Best First'.
Re^2: "Undefined subroutine &main::pcap_lookupdev called" yet module installed and PERL5LIB is set correctly : *(
by stevehicks (Sexton) on Jun 10, 2009 at 14:36 UTC
    Hi Thanks for your help. I tried "use Net::Pcap qw( :all );" and got :
    [mddev@mdsaln01:~/mdscripts/bin] $ ./pcapTest.pl "all" is not defined in %Net::Pcap::EXPORT_TAGS at ./pcapTest.pl line +3 main::BEGIN() called at /opt/devel/mdscripts/PerlModules/lib/N +et/Pcap.pm line 3 eval {...} called at /opt/devel/mdscripts/PerlModules/lib/Net/ +Pcap.pm line 3 Can't continue after import errors at ./pcapTest.pl line 3 BEGIN failed--compilation aborted at ./pcapTest.pl line 3. [mddev@mdsaln01:~/mdscripts/bin] $ </code ..and I tried :functions instead and got the same as at the beginning +: <code> [mddev@mdsaln01:~/mdscripts/bin] $ ./pcapTest.pl Undefined subroutine &main::pcap_lookupdev called at ./pcapTest.pl lin +e 7. [mddev@mdsaln01:~/mdscripts/bin] $
    : ((
      oops, should be :functions, not :all. Fixed
        Hi Thanks again : ) I tried "use Net::Pcap qw( :functions );" and got the same error as the first time :
        [mddev@mdsaln01:~/mdscripts/bin] $ ./pcapTest.pl Undefined subroutine &main::pcap_lookupdev called at ./pcapTest.pl lin +e 6. [mddev@mdsaln01:~/mdscripts/bin] $
        I've got to get this working and this is driving me crazy. The PERL interpreter can clearly find the module but doesn't like the subroutines that it is supposed to be exporting.