I get an error: Can't bless non-reference value at .../Dump.pm line 250. So I tried perl -d server.pl. The error occurs at this expression:# Instanciate object, will start capturing from network my $dump = Net::Packet::Dump->new( filter => 'tcp', noStore => 1, ); while (1) { if (my $frame = $dump->next) { do_stuff($frame); } }
Net::Packet::netpacket_pcap_fp is a reference to a C function:bless(Net::Packet::netpacket_pcap_fp($self->_pcapd), 'IO::File')
and when I print $self->_pcapd in the debugger, I getFILE * netpacket_pcap_fp(pcap_t *pd){ if (pd == NULL) return(0); else return(pd->sf.rfile); }
which I think is a reference (pointer) to the beginning of the data structure written in C of type struct pcapd, which is defined as follows:'_pcapd' => pcap_tPtr=SCALAR(0x896dde8) -> 144211632
So it looks like Net::Packet::Dump is trying to get a FILE* from C and bless it as an 'IO::File'. I've tried many things, even downloading the PeepPoke module so I could inspect that C data structure to be sure that FILE*rfile is not null (and no, it is not null). I found no reference online that suggests others may be having this problem. I am grateful for any advice you can give! Thanks in advance! --jeffguystruct pcap_sf { FILE *rfile; ... }; ... struct pcap { ... struct pcap_sf sf; ... };
In reply to Net::Packet::Dump can't bless non-reference as 'IO::File' by jeffguy
| For: | Use: | ||
| & | & | ||
| < | < | ||
| > | > | ||
| [ | [ | ||
| ] | ] |