GSP
Quick Navigator

Search Site

Unix VPS
A - Starter
B - Basic
C - Preferred
D - Commercial
MPS - Dedicated
Previous VPSs
* Sign Up! *

Support
Contact Us
Online Help
Handbooks
Domain Status
Man Pages

FAQ
Virtual Servers
Pricing
Billing
Technical

Network
Facilities
Connectivity
Topology Map

Miscellaneous
Server Agreement
Year 2038
Credits
 

USA Flag

 

 

Man Pages
IOC::Service::SetterInjection(3) User Contributed Perl Documentation IOC::Service::SetterInjection(3)

IOC::Service::SetterInjection - An IOC Service object which uses Setter Injection

  use IOC::Service::SetterInjection;
  
  my $service = IOC::Service::SetterInjection->new('logger' => (
                    'FileLogger', 'new', [
                        # fetch a component from another container
                        { setLogFileHandle => '/filesystem/log_file_handle' },
                        # fetch a component from our own container
                        { setLogFileFormat => 'log_file_format' }
                    ]));

In this IOC framework, the IOC::Service::SetterInjection object holds instances of components to be managed.

          +--------------+
          | IOC::Service |
          +--------------+
                 |
                 ^
                 |
   +-------------------------------+
   | IOC::Service::SetterInjection |
   +-------------------------------+

new ($name, $component_class, $component_constructor, $setter_parameters)
Creates a service with a $name, and uses the $component_class and $component_constructor string arguments to initialize the service on demand.

If the $component_class and $component_constructor arguments are not defined, an IOC::InsufficientArguments exception will be thrown.

Upon request of the component managed by this service, an attempt will be made to load the $component_class. If that loading fails, an IOC::ClassLoadingError exception will be thrown with the details of the underlying error. If the $component_class loads successfully, then it will be inspected for an available $component_constructor method. If the $component_constructor method is not found, an IOC::ConstructorNotFound exception will be thrown. If the $component_constructor method is found, then it will be called.

Once a valid instance has been created, then the $setter_parameter array ref is looped through. Each parameter is then a hash ref, the key being the setter method name and the value being the name of a Service (available through "get" or "find"). It is then checked if the setter method is available, if not a IOC::MethodNotFound exception is thrown. It if is found, then it is called and passed the value of the resolved service name.

Work on the documentation

None that I am aware of. Of course, if you find a bug, let me know, and I will be sure to fix it.

I use Devel::Cover to test the code coverage of my tests, see the CODE COVERAGE section of IOC for more information.

Setter Injection in the PicoContainer is explained on this page
<http://docs.codehaus.org/display/PICO/Setter+Injection>

stevan little, <stevan@iinteractive.com>

Copyright 2004-2007 by Infinity Interactive, Inc.

<http://www.iinteractive.com>

This library is free software; you can redistribute it and/or modify it under the same terms as Perl itself.

2007-04-22 perl v5.32.1

Search for    or go to Top of page |  Section 3 |  Main Index

Powered by GSP Visit the GSP FreeBSD Man Page Interface.
Output converted with ManDoc.