The Perl Toolchain Summit needs more sponsors. If your company depends on Perl, please support this very important event.

NAME

Devel::ebug::Wx::Service::ServiceManager - manage services

SYNOPSIS

  my $sm = $wxebug->service_manager; # or find it elsewhere
  my $service = $sm->get_service( $service_name );
  # use the $service

  # alternate ways of getting a service
  my $srv = $wxebug->service_manager->get_service( 'foo_frobnicate' );
  my $srv = $wxebug->foo_frobnicate_service;

DESCRIPTION

The service manager is responsible for finding, initializing and terminating services. Users of the service usually need just to call get_service to retrieve a service instance.

METHODS

services

  my @service_classes = Devel::ebug::Wx::ServiceManager->services;

Returns a list of service classes known to the service manager.

active_services

  my @services = $sm->active_services;

Returns a list of services currently registered with the service manager.

initialize

  $sm->initialze( $wxebug );

Calls initialize on all service instances and sets their initialized property to true.

load_configuration

  $sm->load_configuration;

Calls load_configuration on all service instances.

maybe_call_method

  $sm->maybe_call_method( $method, @args );

Calls method $method on all active services that provide it, passing @args as arguments.

finalize

  $sm->finalize( $wxebug );

Calls save_configuration on all service instances, then calls finalize on them and sets their finalized property to true.

Important: the initialized property is still true even after finalize has been called..

get_service

  my $service_instance = $sm->get_service( 'service_name' );

Returns an active service with the given name, or undef if none is found. If the service has not been initialized, calls inititialize as well, but not load_configuration.

SEE ALSO

Devel::ebug::Wx::Service::Base