jeffguy has asked for the wisdom of the Perl Monks concerning the following question:
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; ... };
|
|---|
| Replies are listed 'Best First'. | |
|---|---|
|
Re: Net::Packet::Dump can't bless non-reference as 'IO::File'
by Corion (Patriarch) on Dec 08, 2005 at 08:15 UTC | |
by jeffguy (Sexton) on Dec 08, 2005 at 13:49 UTC | |
|
Re: Net::Packet::Dump can't bless non-reference as 'IO::File'
by robin (Chaplain) on Dec 08, 2005 at 13:42 UTC | |
by jeffguy (Sexton) on Dec 08, 2005 at 15:13 UTC |