SDF 2.001: SDF Reference: script Filter

Contents | Parent Topic | Previous Topic | Next Topic
Home | Catalog

# 5.27. script Filter

## Interface

The general syntax is:

      !block script
      ...
      !endblock

See Understanding Filter Interfaces, if necessary.

## Description

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.

## Examples

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

## 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.