Iam pretty new to Perl. I have a requirement of parsing tcpdump file to extract HTTP Request/Response headers, corresponding to successful requests that have query strings. This, I have done using the Net::Analysis package. But I have the additional requirement of writing out the headers to different files based on the server program being requested (like...all requests/responses corresponding to example.com/login.pl, should go to one file).
I realised that the command:
perl -MNet::Analysis -e main HTTP Example3.pm tcpdump.file
invokes the .pm file for each line of the dump file. I was initially thinking of opening one file handle for each unique server program and writing the headers accordingly...But if the .pm file is invoked per line of the input file, this does not seem possible. Iam very new to Perl and am not able to think of the best way to get this done. Could you please help me out in this regard? I have pasted below the simple parser which reads the tcpdump file and prints out the request/response headers for successful requests with query strings.
Thanks a lot,