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::Object - Taco Perl object module

SYNOPSIS

    my $obj = $taco->construct_object('ClassName', args => [...]);

    my $result = $obj->call_method('method_name', args => [...]);
    $obj->set_attribute('attribute_name', $value);
    my $value = $obj->get_attribute('attribute_name');

DESCRIPTION

This class is used to represent objects through by Taco actions. Instances of this class will returned by methods of Alien::Taco objects and should not normally be constructed explicitly.

The objects reside on the server side and are referred to by instances of this class by their object number. When these instances are destroyed the destroy_object action is sent automatically.

METHODS

Taco Methods

call_method('method_name', [args => \@args], [kwargs => \%kwargs])

Invoke the given method on the object with the specified arguments and keyword arguments. The context (void / scalar / list) of this method call is detected and sent as an action parameter.

get_attribute('attribute_name')

Retrieve the value of the given attribute.

set_attribute('attribute_name', $value)

Set the value of the given attribute.

Convenience Methods

method('method_name')

Return a subroutine reference which calls the given function with plain arguments only. For example:

    my $ymd = $afd->method('ymd');
    print $ymd->('/'), "\n";

JSON Methods

TO_JSON

This method will be called by the JSON encoder to convert the object to a hashref which is encodable as JSON.