5.27. script Filter


The general syntax is:

  !block script

See Understanding Filter Interfaces, if necessary.


The script filter can be used to embed arbitrary Perl source code within an SDF document. This is useful for many things including:

  • declaring Perl subroutines implementing SDF filters and macros
  • accessing databases
  • updating log files.


!block script
printf STDERR "Hello world!\n";

Limitations & Future Directions

As arbitrary sections of Perl can be included and executed, the code can potentially cause harm. At the moment, the ability to update external files from within an SDF document is seen as a feature. However, a version of SDF which restricts the embedded Perl to "safe" operations would be nice.