real_import#

Low-level installer that wires a pre-blessed object or code ref into the tokenizer. Called by filter_add after it has determined the filter shape; not intended for direct user calls.

Synopsis#

Filter::Util::Call::real_import($object_or_coderef, $package, $is_coderef);

What you get back#

Nothing. real_import installs the filter as a side effect: the tokenizer now routes every read through it until filter_del is called or compilation of the enclosing file finishes.

The three arguments carry the state that the tokenizer will hand back to every filter invocation:

  • $object_or_coderef - the blessed filter object (method filter) or the anonymous sub (closure filter).

  • $package - the module name, used in diagnostic messages such as "Filter::Util::Call - MyFilter::filter returned N values, 1 was expected".

  • $is_coderef - 1 if the first argument is a code ref (the closure-filter shape), 0 if it is a blessed object (the method-filter shape).

Edge cases#

  • If real_import runs outside the compiler (for example at runtime), registration silently succeeds but the filter is never invoked - there is no parser to drive it.

  • The module-name argument is copied into a C-string buffer that lives for the lifetime of the process; filter registrations are intentionally not reclaimed.

Differences from upstream#

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

See also#

  • filter_add - the high-level entry point that prepares arguments and calls real_import.

  • unimport - the inverse operation, exposed for no MyFilter idioms.