The Perl Toolchain Summit needs more sponsors. If your company depends on Perl, please support this very important event.

NAME

clio - Command Line Input/Output with sockets and HTTP

VERSION

version 0.02

SYNOPSIS

    $ cpanm Clio                    # install
    $ vim ~/clio.conf               # configure
    $ CLIO_CONFIG=~/clio.conf clio  # run

DESCRIPTION

Clio will allow you to connect to your command line utilities over network socket and HTTP.

CONFIGURATION

    <Daemon>
        User nobody
        Group nobody

        PidFile /var/run/clio.pid
    </Daemon>

    <Command>

        # Echo chamber
        Exec "cat -"

        # or watch you log files
        # Exec "tail -f /var/log/{maillog,messages,secure}"

        # or run top in batch mode
        # Exec "top -b"

        # or shell backdoor
        # Exec "sh -s"

        StartCommands          0
        MinSpareCommands       0
        MaxSpareCommands       0
        MaxCommands            20
        MaxClientsPerCommand   10

        InputFilter  LineEnd
        OutputFilter  +MyClio::OutputFilter
    </Command>

    # HTTP server with WebSocket clients
    <Server>
        Listen 0:12345

        Class HTTP

        # HTTP server Plack app wrapper 
        Builder /var/www/clio/plack.psgi

        <Client>
            Class WebSocket

            InputFilter  +MyClio::InputFilter::Uppercase
            OutputFilter LineEnd
        </Client>
    </Server>

    <Log>
        Class Log4perl
        <Config>
            log4perl.logger=Error, Log

            log4perl.appender.Log=Log::Dispatch::File
            log4perl.appender.Log.filename=/var/log/clio/clio.log
            log4perl.appender.Log.mode=append
            log4perl.appender.Log.layout=Log::Log4perl::Layout::SimpleLayout
        </Config>
    </Log>

There are folowing main configuration blocks:

Daemon

If <Daemon> is present then clio process will daemonize itself.

  • User

  • Group

    Specify user and group under which the server will answer requests.

  • PidFile

    Path to pid file.

Command

Configuration block of command to be executed.

  • Exec

    Command to be executed.

  • StartCommands

    Number of command processes created at startup.

  • MinSpareCommands

    Minimum number of idle command processes.

  • MaxSpareCommands

    Maximum number of idle command processes.

  • MaxCommands

    Maximum number of running command processes.

  • MaxClientsPerCommand

    Maximum number of connected client processes per command.

  • InputFilter

  • OutputFilter

    Optional name of the packages used to filter command's input and output.

    If name does not start with + then Clio::Process prefix will be used to load specified filter, eg Clio::ProcessInputFilter::LineEnd.

Server

  • Listen

    IP address and port that the server listens to.

  • Class

    Name of the package acting as server.

    If name does not start with + then Clio::Server:: prefix will be used to load specified filter, eg Clio::Server::HTTP.

    Servers may specify additional parameters, eg. Clio::Server::HTTP allows Builder option.

  • Builder

    Optional path to file returning Plack application - object with to_app() method or simply PSGI applicationcode reference, see examples/ dir.

    Note: option used by Clio::Server::HTTP only.

  • Client

    Inner block defining Server's Client options.

    • Class

      Name of the package acting as client.

      If name does not start with + then resolved Server's Class prefix + ::Client:: will be used to load specified filter, eg Clio::Server::HTTP::Client::WebSocket.

    • InputFilter

    • OutputFilter

      Optional name of the packages used to filter client's input and output.

Log

Log configuration block.

  • Class

    Name of the package acting as logger.

    If name does not start with + then Clio::Log:: prefix will be used to load specified filter, eg Clio::Log::Log4perl.

  • Config

    Class specific configuration.

AUTHOR

Alex J. G. Burzyński <ajgb@cpan.org>

COPYRIGHT AND LICENSE

This software is copyright (c) 2012 by Alex J. G. Burzyński <ajgb@cpan.org>.

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