483a52ad3f2084159098b0c8477f59596950ac6c
[catagits/Reaction.git] / lib / Reaction / InterfaceModel / Action / Role / SimpleMethodCall.pm
1 package Reaction::InterfaceModel::Action::Role::SimpleMethodCall;
2
3 use Reaction::Role;
4 use Scalar::Util 'blessed';
5 requires '_target_model_method';
6
7 sub can_apply { 1; }
8
9 sub do_apply {
10   my ($self) = @_;
11   my $object = $self->target_model;
12   my $method_name = $self->_target_model_method;
13   if(my $method_ref = $object->can($method_name)){
14     return $object->$method_ref();
15   }
16   confess("Object ".blessed($object)." doesn't support method ${method_name}");
17 }
18
19 1;
20
21 __END__;
22
23 =head1 NAME
24
25 Reaction::InterfaceModel::Action::Role::SimpleMethodCall
26
27 =head1 DESCRIPTION
28
29 =head1 AUTHORS
30
31 See L<Reaction::Class> for authors.
32
33 =head1 LICENSE
34
35 See L<Reaction::Class> for the license.
36
37 =cut
38