On Wednesday, August 28, 2002, at 03:49 , Bridget Benson wrote:

> I am having trouble using the Net::RawIP::dump function.
>
> I keep getting the error Bad filehandle for line 4 in this code.
> What is wrong with $fh?
>
> $p = open_offline($filename);
> $fh = dump_open($p, "file");
> $packet = next($p, \%hdr);
> dump($fh, \%hdr, $packet);


let's start with a few basics - so we are sure we are
on the same page - I just downloaded the module and
started some poking around in it - you do have the
libpcap installed?

you can read the documentation for Net::RawIP - with
the standard perl tool

        perldoc Net::RawIP

which will help you with some of what perl is trying to
do - and I think you may have a conflict with what
you are trying to do in those four specific lines.

from the synopsis it appears that you want to go with say

       $p = $a->pcapinit("eth0","dst port 21",1500,30);
       $f = dump_open($p,"/my/home/log");
       loop $p,10,\&dump,$f;

to fill up the file and that the dump command - in
that sequence "\&dump" is the address to a dump -
and in your case - I think you wanted to go with
the off_line case

        my $p = pcapinit_offline($fname)

where $fname wsa the file that data had been dumped to.

that $p is the perl version of a (pcap_t *)

the function next returns a string scalar - the next packet,
which seems to be taking a pcap_t * - but I'm having a bit
of trouble finding a working go on the %hdr -

I have not been able to find a clean version of the Net::RawIP::Lipcap(3pm)
but you may want to see if you get any information from

        perldoc Net::RawIP::libcap


hope that at least gets you started in the right general direction.



ciao
drieux

---


-- 
To unsubscribe, e-mail: [EMAIL PROTECTED]
For additional commands, e-mail: [EMAIL PROTECTED]

Reply via email to