filter_del#

Remove the calling filter from the active chain. Subsequent reads bypass it and hit the next filter down (or the source file).

Synopsis#

filter_del();

What you get back#

Nothing useful — filter_del is a statement, not an expression.

It does not stop the current filter invocation: the caller finishes its current call and returns a status to the compiler normally. Starting with the next read, the compiler skips this filter and reads from whatever sat below it in the chain.

Examples#

Disable the filter as soon as a sentinel line is seen, so the compiler processes the rest of the file untouched:

sub filter {
    my $status = filter_read();
    if ($status > 0 && /^__END_FILTER__$/) {
        filter_del();
        $_ = '';     # drop the sentinel line itself
    }
    $status;
}

Edge cases#

  • Calling filter_del when no filter is active is a no-op.

  • filter_del marks the filter inactive but does not free its per-filter state; the tokenizer releases that state when it tears down the parser at end of compilation.

Differences from upstream#

Fully compatible with upstream Filter::Util::Call 1.65.

See also#

  • filter_add — installs the filter that filter_del later removes.

  • filter_read — normally called right before filter_del in the sentinel branch.