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

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.
  • Comment on Re^4: "Undefined subroutine &main::pcap_lookupdev called" yet module installed and PERL5LIB is set correctly : *(
  • Download Code

Replies are listed 'Best First'.
Re^5: "Undefined subroutine &main::pcap_lookupdev called" yet module installed and PERL5LIB is set correctly : *(
by ikegami (Patriarch) on Jun 10, 2009 at 18:09 UTC

    The PERL interpreter can clearly find the module but doesn't like the subroutines that it is supposed to be exporting.

    Perl (the language) and perl (the interpreter) have nothing to do with exporting (it's all up to the module), and the subs weren't supposed to be exported until you used :functions. Your problem with :functions is different, even though it results in the same error message.

      I defer to your clearly far greater understanding of perl : ) I'm running out of ideas fast other than trying a different version of the Net::Pcap module. I mean, I don;t know how to fix this and I have to be be able to use the module directly. I'll also try it on a linux host but i get the feeling it'll work and give me no further clues even with the same directory paths and PERL5LIB and same code : * {
        try this:

        #!/usr/bin/perl use Net::Pcap qw( :functions ); $|=1; my $err = ''; my $dev = lookupdev(\$err); my $pcap = open_live( $dev, 1024, 1, 0, \$err ); loop( $pcap, 10, \&process_packet, "just for the demo" ); pcap_close( $pcap ); sub process_packet { my($user_data, $header, $packet ) = @_; }