The Perl Toolchain Summit needs more sponsors. If your company depends on Perl, please support this very important event.

Parsing plugins

  1. LineNumber.pm - <line> - Extract whole line
  2. Regex.pm - <regex> - Regular expression
  3. XPath.pm - <xpath> - XML XPath
  4. JSON.pm - <json> - JSON path

LineNumber.pm (<line> directive)

Perhaps the simplest parsing plugin M3 has to offer. This plugin will extract a whole line from the output. Having for instance the output of:

Hello World

Would result in the following parsing:

Regex.pm (<regex> directive)

The first and perhaps most powerful parsing plugins M3 has to offer.

Regular expressions are extremely simple yet very powerful and flexible.

Numerous examples exist in the different sample configuration files.

The regex plugin most commonly used feature is to extract the whole output:

<regex>(.*)</regex>

For instance, extracting the second word in a sentence would be:

The quick brown fox jumps over the lazy dog

If you are unfamiliar with regular expressions and would still like to use them, I suggest further reading.

XPath.pm (<xpath> directive)

XPath would retrieve a XML path from XML formatted output.

An example XPath would look like:

Generally speaking you could have a look JSON.pm (<json> directive)

Very similar to the XPath.pm, this plugin will extract a JSON path.

An example for a JSON path would look like:

<json>{'forecast'}[0]->{'low_temperature'}</json>