The London Perl and Raku Workshop takes place on 26th Oct 2024. If your company depends on Perl, please consider sponsoring and/or attending.

NAME

Text::APL::Writer - writer

DESCRIPTION

Write a template output to various destinations. Accepts a subroutine for a custom implementation.

Returns a reference to subroutine. When called accepts a chunk of template output. Chunk is undefined when template is fully processed. When received an undefined chunk one can close a file, drop the connection etc.

For example a writer to a file handle is implemented as:

        sub { print $output $_[0] };

The following destinations are implemented:

    $reader->(\$scalar);
    $reader->($filename);
    $reader->($filehandle);
    $reader->(sub {...custom code...});

Custom subroutines are used for non-blocking output writing. See examples/ directory for an example using IO::AIO for non-blocking output writing.

METHODS

build

Build a writer.