NAME

IPC::Manager::Service::Echo - Service that echoes back request content

DESCRIPTION

A lightweight service that echoes every request back to the caller. For each incoming request the response is the string "echo: " followed by the request payload.

This is useful for smoke-testing IPC connectivity, verifying that the exec service code path works, and as a minimal example of a custom service class that composes IPC::Manager::Role::Service.

SYNOPSIS

use IPC::Manager qw/ipcm_service/;

# In-process (forked) echo service
my $handle = ipcm_service('echo', class => 'IPC::Manager::Service::Echo');

my $resp = $handle->sync_request(echo => "hello");
# $resp->{response} is "echo: hello"

$handle = undef;    # shuts down the service

# Via exec (fresh interpreter)
my $handle = ipcm_service(
    'echo',
    class => 'IPC::Manager::Service::Echo',
    exec  => { cmd => [] },
);

METHODS

$response = $svc->handle_request($req, $msg)

Returns "echo: $req->{request}".

See IPC::Manager::Role::Service for inherited methods.

SOURCE

The source code repository for IPC::Manager can be found at https://github.com/exodist/IPC-Manager.

MAINTAINERS

Chad Granum <exodist@cpan.org>

AUTHORS

Chad Granum <exodist@cpan.org>

COPYRIGHT

Copyright Chad Granum <exodist7@gmail.com>.

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

See https://dev.perl.org/licenses/