NAME

App::ansicolumn::Command - App::cdif::Command compatible interface

SYNOPSIS

use App::ansicolumn::Command;

# With external command
my $obj = App::ansicolumn::Command->new;
my $result = $obj->command('ansicolumn', '-t')
                 ->setstdin($data)
                 ->update
                 ->data;

# With code reference (no fork)
use App::ansicolumn qw(ansicolumn);
my $obj = App::ansicolumn::Command->new;
my $result = $obj->command(\&ansicolumn, '-t')
                 ->setstdin($data)
                 ->update
                 ->data;

DESCRIPTION

This module provides an App::cdif::Command compatible interface.

When a code reference is passed as the first element of the command, it is called directly without forking a new process. This is useful when used with App::Greple::tee module's discrete mode, where the overhead of forking multiple processes can be significant.

METHODS

new()

Create a new App::ansicolumn::Command object.

command(@args)

Set the command arguments. If the first argument is a code reference, it will be called directly without forking.

setstdin($data)

Set the input data to be processed.

update()

Execute the command or code reference.

data()

Return the processed output.

SEE ALSO

App::ansicolumn, App::cdif::Command, App::Greple::tee

AUTHOR

Kazumasa Utashiro

LICENSE

Copyright 2020- Kazumasa Utashiro.

This library is free software; you can redistribute it and/or modify it under the same terms as Perl itself.