Alien-Taco

 view release on metacpan or  search on metacpan

lib/Alien/Taco/Object.pm  view on Meta::CPAN

# Taco Perl object module.
# Copyright (C) 2013-2014 Graham Bell
#
# This program is free software: you can redistribute it and/or modify
# it under the terms of the GNU General Public License as published by
# the Free Software Foundation, either version 3 of the License, or
# (at your option) any later version.
#
# This program is distributed in the hope that it will be useful,
# but WITHOUT ANY WARRANTY; without even the implied warranty of
# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
# GNU General Public License for more details.
#
# You should have received a copy of the GNU General Public License
# along with this program.  If not, see <http://www.gnu.org/licenses/>.

=head1 NAME

Alien::Taco::Object - Taco Perl object module

=head1 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');

=head1 DESCRIPTION

This class is used to represent objects through by Taco actions.
Instances of this class will returned by methods of L<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 I<destroy_object> action is sent automatically.

=cut

package Alien::Taco::Object;

use strict;

our $VERSION = '0.003';

# new($taco_client, $object_number)
#
# Constructs a new instance of this class.  A reference to the Taco client
# is stored to allow actions to be sent via it.

sub new {
    my $class = shift;
    my $client = shift;
    my $number = shift;

    return bless {client => $client, number => $number}, $class;
}

# DESTROY
#
# Destructor method.  This invokes the _destroy_object method of
# the Taco client so that the object on the server side can be deleted.

sub DESTROY {
    my $self = shift;

    $self->{'client'}->_destroy_object($self->{'number'});
}

=head1 METHODS

=head2 Taco Methods

=over 4



( run in 0.631 second using v1.01-cache-2.11-cpan-df04353d9ac )