aboutsummaryrefslogtreecommitdiffstats
path: root/lib/Reaction/InterfaceModel
diff options
context:
space:
mode:
authorgroditi <groditi@03d0b0b2-0e1a-0410-a411-fdb2f4bd65d7>2009-06-16 20:49:10 +0000
committergroditi <groditi@03d0b0b2-0e1a-0410-a411-fdb2f4bd65d7>2009-06-16 20:49:10 +0000
commitbcbb11e940adefa53d7bbe1d67f65957822ea56d (patch)
tree1d70d328408b8e211e938f0e4d1897748d71a5ee /lib/Reaction/InterfaceModel
parente516f7e6ba9d9d2a2e095667afe7b49446de4812 (diff)
downloadreaction-bcbb11e940adefa53d7bbe1d67f65957822ea56d.tar.gz
reaction-bcbb11e940adefa53d7bbe1d67f65957822ea56d.zip
throw more helpful errors
Diffstat (limited to 'lib/Reaction/InterfaceModel')
-rw-r--r--lib/Reaction/InterfaceModel/Action/Role/SimpleMethodCall.pm9
1 files changed, 7 insertions, 2 deletions
diff --git a/lib/Reaction/InterfaceModel/Action/Role/SimpleMethodCall.pm b/lib/Reaction/InterfaceModel/Action/Role/SimpleMethodCall.pm
index 285ddb1..4066d3c 100644
--- a/lib/Reaction/InterfaceModel/Action/Role/SimpleMethodCall.pm
+++ b/lib/Reaction/InterfaceModel/Action/Role/SimpleMethodCall.pm
@@ -1,14 +1,19 @@
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) = @_;
- $self->target_model->${\$self->_target_model_method};
+ 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;