Recently I was reading the blogpost on the BrekingPoint labs log about parsing pcap files with Perl and I immediately said to myself: it is impossible that there isn’t a module on CPAN, because Perl is great. Turns out I was right, there is Net::TcpDumpLog which can be combined with the NetPacket family of modules to parse the higher level protocols. Because example code is rather sparse on the POD pages of the respective modules, here is a small example to illustrate their use:
Tag Archives: perl
WordNet Perl Module
This WordNet module (WordNet::QueryData) is a Perl interface to the WordNet database. WordNet is a database of word meanings and lexical relationships. It contains tens of thousands of words and numerous semantic relationships for each. For example, it can tell you that a limousine is a type of a car and that a car is a type of motor vehicle. It can also tell you that car and automobile have essentially the same meaning.
via WordNet Perl Module.
Perl Regular Expressions
Now what if you want the comparison to be case insensitive? All you do is add the letter i after the ending delimiter:
$string =~ m/^sought_text$/i;
regex – How do you match only valid roman numerals with a regular expression?
^M{0,4}(CM|CD|D?C{0,3})(XC|XL|L?X{0,3})(IX|IV|V?I{0,3})$
via regex – How do you match only valid roman numerals with a regular expression? – Stack Overflow.
Perl Reference
Why search yourself, though? perldoc’s -f switch searches perlfunc for you, presenting only the documentation for the named operator. Type instead:
$ perldoc -f substr
Pd-extended and random-data streams
Here’s a little something I wrote to take the checksums from incoming data on a network and turn these into useful data in Pd-extended. We communicate the data via the OSC (OpenSoundControl) protocol.
This uses:
- tcpdump
- Some sort of fifo
- Perl (to build our OSC packets)
- Pd-extended