Alien-Taco

 view release on metacpan or  search on metacpan

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

    my $value = shift;

    $self->_interact({
        action => 'set_class_attribute',
        class => $class,
        name => $name,
        value => $value,
    });
}

=item set_value('attribute_name', $value)

Set the value of the given variable.

=cut

sub set_value {
    my $self = shift;
    my $name = shift;
    my $value = shift;

    $self->_interact({
        action => 'set_value',
        name => $name,
        value => $value,
    });
}

=back

=head2 Convenience Methods

The methods in this section additional methods for convenience.

=over 4

=item 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 L</SYNOPSIS>.

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

=cut

sub function {
    my $self = shift;
    my $name = shift;

    return sub {
        $self->call_function($name, args => \@_);
    };
}

=item constructor('ClassName')

Return a subroutine reference to call the constructor for the
specified class, with plain arguments.  For example, to
allow multiple L<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 L</construct_object>
method:

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

=cut

sub constructor {
    my $self = shift;
    my $class = shift;

    return sub {
        $self->construct_object($class, args => \@_);
    };
}

1;

__END__

=back

=cut



( run in 0.544 second using v1.01-cache-2.11-cpan-411bb0df24b )