Graham Bell
and 1 contributors

NAME

Alien::Taco - Taco Perl client module

SYNOPSIS

    use Alien::Taco;

    my $taco = new Alien::Taco(lang => 'perl');
    $taco->call_function('CORE::sleep', args => [10]);

DESCRIPTION

This is the Taco client module for Perl.

METHODS

Constructor

new(lang => 'language' | script => 'server_script')

Connect to a Taco server instance. The server script can either be specified explicitly, or the language can be given. In that case the server script will be assumed to be named taco-language and installed in your executable search path ($PATH).

The server script will be launched in a subprocess, and a Alien::Taco::Transport object will be attached to it.

Taco Methods

The methods in this section allow the corresponding Taco actions to be sent.

call_class_method('class_name', 'function_name', [args => \@args], [kwargs => \%kwargs])

Invoke a class method call within the Taco server script, returning the result of that method. The context (void / scalar / list) is detected and sent as a parameter. Since Perl subroutine arguments are expanded into a list, the arguments and keyword arguments must be given separately.

call_function('function_name', [args => \@args], [kwargs => \%kwargs])

Invoke a function call within the Taco server script, returning the result of that function. The context (void / scalar / list) is detected and sent as a parameter. Since Perl subroutine arguments are expanded into a list, the arguments and keyword arguments must be given separately.

construct_object('class', [args => \@args], [kwargs => \%kwargs])

Invoke an object constructor. If successful, this should return an Alien::Taco::Object instance which references the new object. The given arguments are passed to the object constructor.

get_value('variable_name')

Request the value of the given variable.

import_module('Module::Name', [args => \@args], [kwargs => \%kwargs])

Instruct the server to load the specified module. The interpretation of the arguments depends on the language of the Taco server implementation.

set_value('attribute_name', $value)

Set the value of the given variable.

Convenience Methods

The methods in this section additional methods for convenience.

function('function_name')

Return a subroutine reference which calls the given function with plain arguments only. The following example is equivalent to that given in the "SYNOPSIS".

    my $sleep = $taco->function('CORE::sleep');
    $sleep->(10);
constructor('ClassName')

Return a subroutine reference to call the constructor for the specified class, with plain arguments. For example, to allow multiple DateTime objects to be constructed easily, a constructor can be used:

    my $datetime = $taco->constructor('DateTime');
    my $afd = $datetime->(year => 2000, month => 4, day => 1);

This is equivalent to calling the "construct_object" method:

    my $afd = $taco->construct_object('DateTime',
        kwargs => {year => 2000, month => 4, day => 1});