| 1 | package OpenInteract2::Setup::InitializeControllers; | ||||||||||||||||||||
| 2 | |||||||||||||||||||||
| 3 | # $Id: InitializeControllers.pm,v 1.4 2005/03/18 04:09:51 lachoy Exp $ | ||||||||||||||||||||
| 4 | |||||||||||||||||||||
| 5 | 87 | ▶ | use strict; | ||||||||||||||||||
|
Subroutine
BEGIN: called CC=1 SCAR=0.0
| |||||||||||||||||||||
| 6 | 87 | ▶ | use base qw( OpenInteract2::Setup ); | ||||||||||||||||||
|
Subroutine
BEGIN: called CC=1 SCAR=0.0
| |||||||||||||||||||||
| 7 | 87 | ▶ | use Log::Log4perl qw( get_logger ); | ||||||||||||||||||
|
Subroutine
BEGIN: called CC=1 SCAR=0.0
| |||||||||||||||||||||
| 8 | 87 | ▶ | use OpenInteract2::Constants qw( LOG_INIT ); | ||||||||||||||||||
|
Subroutine
BEGIN: called CC=1 SCAR=0.0
| |||||||||||||||||||||
| 9 | 87 | ▶ | use OpenInteract2::Controller; | ||||||||||||||||||
|
Subroutine
BEGIN: called CC=1 SCAR=0.0
| |||||||||||||||||||||
| 10 | 87 | ▶ | use OpenInteract2::Exception qw( oi_error ); | ||||||||||||||||||
|
Subroutine
BEGIN: called CC=1 SCAR=0.0
| |||||||||||||||||||||
| 11 | 87 | ▶ | use OpenInteract2::Util; | ||||||||||||||||||
|
Subroutine
BEGIN: called CC=1 SCAR=0.0
| |||||||||||||||||||||
| 12 | |||||||||||||||||||||
| 13 | 87 | $OpenInteract2::Setup::InitializeControllers::VERSION = sprintf("%d.%02d", q$Revision: 1.4 $ =~ /(\d+)\.(\d+)/); | |||||||||||||||||||
| 14 | |||||||||||||||||||||
| 15 | 87 | my ( $log ); | |||||||||||||||||||
| 16 | |||||||||||||||||||||
| 17 | 87 | ▶ | sub get_name { | ||||||||||||||||||
|
Subroutine
get_name: called CC=1 SCAR=0.0
Pod
undocumented
| |||||||||||||||||||||
| 18 | 87 | return 'initialize controllers'; | |||||||||||||||||||
| 19 | } | ||||||||||||||||||||
| 20 | |||||||||||||||||||||
| 21 | 1 | ▶ | sub get_dependencies { | ||||||||||||||||||
|
Subroutine
get_dependencies: called CC=1 SCAR=0.0
Pod
undocumented
| |||||||||||||||||||||
| 22 | 1 | return ( 'initialize actions' ); | |||||||||||||||||||
| 23 | } | ||||||||||||||||||||
| 24 | |||||||||||||||||||||
| 25 | 0 | ▶ | sub execute { | ||||||||||||||||||
|
Subroutine
execute: not called CC=4 SCAR=30.0
Pod
undocumented
| |||||||||||||||||||||
| 26 | 0 | my ( $self, $ctx ) = @_; | |||||||||||||||||||
| 27 | 0 | ▶ | $log ||= get_logger( LOG_INIT ); | ||||||||||||||||||
|
Condition0%0/3
$log ||= get_logger("OI2.INITIALIZE")
MC/DC0%0/2
$log ||= get_logger("OI2.INITIALIZE")
$log
get_logger("OI2.INITIALIZE")
Truth table0%0/3
A ||= B
A= $logB= get_logger("OI2.INITIALIZE")
| |||||||||||||||||||||
| 28 | 0 | my $controllers = $ctx->lookup_controller_config; | |||||||||||||||||||
| 29 | 0 | ▶ | while ( my ( $name, $info ) = each %{ $controllers } ) { | ||||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||||
| 30 | 0 | OpenInteract2::Controller->register_factory_type( $name => $info->{class} ); | |||||||||||||||||||
| 31 | } | ||||||||||||||||||||
| 32 | 0 | my @observers = OpenInteract2::Util->find_factory_subclasses( | |||||||||||||||||||
| 33 | 'OpenInteract2::Observer::Controller', | ||||||||||||||||||||
| 34 | ); | ||||||||||||||||||||
| 35 | 0 | foreach my $observer ( @observers ) { | |||||||||||||||||||
| 36 | 0 | OpenInteract2::Controller->add_observer( $observer ); | |||||||||||||||||||
| 37 | 0 | $log->info( "Added observer '$observer' to the controller" ); | |||||||||||||||||||
| 38 | } | ||||||||||||||||||||
| 39 | } | ||||||||||||||||||||
| 40 | |||||||||||||||||||||
| 41 | 87 | OpenInteract2::Setup->register_factory_type( get_name() => __PACKAGE__ ); | |||||||||||||||||||
| 42 | |||||||||||||||||||||
| 43 | 87 | 1; | |||||||||||||||||||
| 44 | |||||||||||||||||||||
| 45 | __END__ | ||||||||||||||||||||