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

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

Replies are listed 'Best First'.
Re^8: "Undefined subroutine &main::pcap_lookupdev called" yet module installed and PERL5LIB is set correctly : *(
by stevehicks (Sexton) on Jun 10, 2009 at 20:32 UTC
    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 : )))
        Good point; however the issue here isn't subs but functions. "pcap_lookupdev" isn't listed under functions in the source but "lookupdev" is. There's a big difference.