| RWDE documentation | Contained in the RWDE distribution. |
Proxy object for getting the specific functionality of a particular object
To avoid require, eval and invocation from within a block of code, which is suboptimal, the proxy object instantiates the object, invokes the function with the given params hash and returns the result.
| RWDE documentation | Contained in the RWDE distribution. |
package RWDE::Proxy; use strict; use warnings; use RWDE::AbstractFactory; use vars qw($VERSION); $VERSION = sprintf "%d", q$Revision: 507 $ =~ /(\d+)/;
sub invoke { my ($self,$params) = @_; my $function = $$params{'function'} or throw RWDE::DevelException({ info => 'Proxy::Parameter error - function not specified'}); my $term = RWDE::AbstractFactory->instantiate($params); return $term->$function($params); } 1;