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_state

$sm->load_state;

Calls load_state on all service instances.

finalize

$sm->finalize( $wxebug );

Calls save_state 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_state.

SEE ALSO

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