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

Alien::Taco::Server - Taco Perl server module

SYNOPSIS

    use Alien::Taco::Server;
    my $server = new Alien::Taco::Server();
    $server->run();

DESCRIPTION

This module provides a Perl implementation of the actions required of a Taco server.

SUBROUTINES

Main Methods

new()

Set up a Alien::Taco::Transport object communicating via STDIN and STDOUT.

STDERR is selected as the current stream to try to avoid any subroutine or method calls printing to STDOUT which would corrupt communications with the client.

run()

Enter the message handling loop, which exits on failure to read from the transport.

Taco Action Handlers

call_class_method($message)

Call the class method specified in the message, similarly to call_function.

call_function($message)

Call the function specified in the message. The function is called in the requested context (void / scalar / list) if specified. A context of "map" can also be specified to avoid the client having to convert a list to a hash in cases where the function returns a hash directly.

The function is called with an argument list consisting of the args followed by the kwargs in list form. To supply a hash reference to the function, a hash should be placed inside one of the arguments paramters of the message.

call_method($message)

Call an object method, similarly to call_function.

construct_object($message)

Call an object constructor.

destroy_object($message)

Remove an object from the cache.

get_attribute($message)

Attempt to read an object attribute, but this depends on the object being a blessed HASH reference. If so then the named HASH entry is returned. Typically, however, Perl object values will be accessed by calling the corresponding method on the object instead.

get_class_attribute($message)

Attempt the read a variable from the given class's package. The attribute name should begin with the appropriate sigil ($ / @ / %).

get_value($message)

Try to read the given variable. The variable name should begin with the appropriate sigil ($ / @ / %).

import_module($message)

Convert the supplied module name to a path by replacing :: with / and appending .pm. Then require the resulting module file and call its import subroutine. Any parameters provided are passed to import.

set_attribute($message)

Attempt to set an attribute of an object, but see the notes for get_attribute above.

set_class_attribute($message)

Attempt to set a variable in the given class's package. The attribute name should begin with the appropriate sigil ($ / @ / %).

set_value($message)

Assign to the given variable. The variable name should begin with the appropriate sigil ($ / @ / %).