Skip to content
Deane Barker edited this page May 30, 2018 · 3 revisions

Selective Commenting

A common programming tool is to remove lines of code that might be causing problems, and examine the operation of the code without them. This is highly relevant to a pipeline system like Denina.

For example:

Http.Get -url:http://example.com
Html.Extract -path:title
Html.WrapTag -tag:div

Assume that we are not getting the result we expect from this pipeline. We don't know where the problem is -- there's a chance the output of the first 1 -- an HTTP call -- might be wrong, which means every step after it could be working on invalid input. It might be helpful to walk through the pipeline step-by-step to see what each filter is doing that.

An easy way to do this is by "commenting out" steps 2 and 3, to examine the output of step 1 and determine if it's what we expect. (For more on commenting, see the very end of Commands and Arguments).

Http.Get -url:http://example.com
# Html.Extract -path:title
# Html.WrapTag -tag:div

By adding a # to the beginning of lines 2 and 3, they are no longer executed. They are considered "commentary" by the Denina engine. These leaves line 1 as the only executable step, which means its output will be the output of the entire script (remember, the last executable step in a script is the final output).

Commenting allows you to "delete without deleting." My commenting steps, you are effectively removing them from the script without deleting them, which allows you to re-add them selectively to examine the progressive refinement of the input throughout the script.

Viewing Debug Entries

After pipeline/script execution, Denina populates a set of debugging log entries with data from every filter execution. This information can be output for debugging.

Presently, there is only one output format: Core.DumpToXml. (TODO: Add plain text and HTML formats.)

From our script above:

Http.Get -url:http://example.com
Html.Extract -path:title
Html.WrapTag -tag:div
Core.DumpToXml

The final step will simply output all the debugging information for every step of the pipeline, including input/output text for every filter, variables available during the execution of every filter, time elapsed for every filter, etc. See Debug Data for everything that is provided.

If the output is too lengthy, two arguments can make it more readable by removing some information:

  • Set -io:false to remove the input/output data of each filter
  • Set -variables:false to remove the available variables of each filter

Clone this wiki locally