in reply to Re^4: "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 : *(

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.

  • Comment on Re^5: "Undefined subroutine &main::pcap_lookupdev called" yet module installed and PERL5LIB is set correctly : *(
  • Select or Download Code

Replies are listed 'Best First'.
Re^6: "Undefined subroutine &main::pcap_lookupdev called" yet module installed and PERL5LIB is set correctly : *(
by stevehicks (Sexton) on Jun 10, 2009 at 19:11 UTC
    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 ) = @_; }
        Wow. That worked !! looking at the actual module itself I can see now that the sub names are not prefixed with "pcap_" as the documentation suggests. Thanks guys so very much for all your help. I really appreciate it. If you have any way I can donate a beer then just say the word : )))