Reaction::InterfaceModel::Action::Role::SimpleMethodCall - Reaction::InterfaceModel::Action::Role::SimpleMethodCall documentation


Reaction documentation Contained in the Reaction distribution.

Index


Code Index:

NAME

Top

Reaction::InterfaceModel::Action::Role::SimpleMethodCall

DESCRIPTION

Top

AUTHORS

Top

See Reaction::Class for authors.

LICENSE

Top

See Reaction::Class for the license.


Reaction documentation Contained in the Reaction distribution.

package Reaction::InterfaceModel::Action::Role::SimpleMethodCall;

use Reaction::Role;
use Scalar::Util 'blessed';
requires '_target_model_method';

sub can_apply { 1; }

sub do_apply {
  my ($self) = @_;
  my $object = $self->target_model;
  my $method_name = $self->_target_model_method;
  if(my $method_ref = $object->can($method_name)){
    return $object->$method_ref();
  }
  confess("Object ".blessed($object)." doesn't support method ${method_name}");
}

1;

__END__;