IOC::Proxy::Interfaces

IOC::Proxy::Interfaces is a IOC::Proxy subclasss to proxy objects with a given interface.
Download

IOC::Proxy::Interfaces Ranking & Summary

Advertisement

  • Rating:
  • License:
  • Perl Artistic License
  • Price:
  • FREE
  • Publisher Name:
  • Stevan Little
  • Publisher web site:
  • http://search.cpan.org/~stevan/

IOC::Proxy::Interfaces Tags


IOC::Proxy::Interfaces Description

IOC::Proxy::Interfaces is a IOC::Proxy subclasss to proxy objects with a given interface. IOC::Proxy::Interfaces is a IOC::Proxy subclasss to proxy objects with a given interface.SYNOPSIS use IOC::Proxy::Interfaces; my $proxy_server = IOC::Proxy->new({ interface => 'AnInterface', # ... add other config values here }); $proxy_server->wrap($object); # our $object is now proxied, but only the # methods which are part of the interface # will work, all others will throw exceptions $object->method_in_interface(); # works as normal $object->method_not_in_interface(); # will thrown an exceptionThis is a subclass of IOC::Proxy which allows for the partial proxing of an object. It will only proxy the methods of a given interface, all other methods will throw a IOC::MethodNotFound exception. This could be used to (in a very weird way) emulate the concept of upcasting in Java, it is also somewhat like the idea of using interfaces with Dynamic Proxies in Java as well (see the article link in "SEE ALSO").This proxy can be useful if you need to have an object strictly conform to a particular interface in a particular situation. The interface class is also pushed onto the proxies @ISA so that it will respond to UNIVERSAL::isa($object, 'Interface') correctly. Keep in mind that there is no need for the object being proxied to have the interface in it's @ISA prior to being proxied. The proxy is dynamic and only requires that the object conform to the interface when it is being wraped but the proxy object. Requirements: · Perl


IOC::Proxy::Interfaces Related Software