I desperately need your help. I was looking all evening for a solution to my problem. I'm using Perl 5.10.1 on a 64Bit Ubuntu.
I wanted to play around with Net::Pcap, so I have installed it the command apt-get install libnet-pcap-perl
For my test, I wanted to use an example shown on the CPAN page of Net::Pcap
#!/usr/bin/perl -w use Net::Pcap; my $err = ''; my $dev = pcap_lookupdev(\$err); # find a device # open the device for live listening my $pcap = pcap_open_live($dev, 1024, 1, 0, \$err); # loop over next 10 packets pcap_loop($pcap, 10, \&process_packet, "just for the demo"); # close the device pcap_close($pcap); sub process_packet { my($user_data, $header, $packet) = @_; # do something ... }
If I try to run that script, I get this Answer: "Undefined subroutine &main::pcap_lib_version called at ./test.pl line 7"
However, if I expand the pcap-commands to e.g my $dev = Net::Pcap::pcap_lookupdev(\$err); I don't get any error. It just does nothing because the script is not finished yet, but that's not the point.
Has anyone an Idea what my problem is?
SOLUTION: The funtions need to be exported by request use Net::Pcap qw(:funtions); Thank you Corion!
In reply to Can't use moduels by 'use' directive by PN33D0
| For: | Use: | ||
| & | & | ||
| < | < | ||
| > | > | ||
| [ | [ | ||
| ] | ] |