| 1 | package OpenInteract2::Setup::RegisterRequestAndResponse; | ||||||||||||||||||||
| 2 | |||||||||||||||||||||
| 3 | # $Id: RegisterRequestAndResponse.pm,v 1.2 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 ); | ||||||||||||||||||
|
Subroutine
BEGIN: called CC=1 SCAR=0.0
| |||||||||||||||||||||
| 9 | 87 | ▶ | use OpenInteract2::Exception qw( oi_error ); | ||||||||||||||||||
|
Subroutine
BEGIN: called CC=1 SCAR=0.0
| |||||||||||||||||||||
| 10 | |||||||||||||||||||||
| 11 | 87 | $OpenInteract2::Setup::RegisterRequestAndResponse::VERSION = sprintf("%d.%02d", q$Revision: 1.2 $ =~ /(\d+)\.(\d+)/); | |||||||||||||||||||
| 12 | |||||||||||||||||||||
| 13 | 87 | my ( $log ); | |||||||||||||||||||
| 14 | |||||||||||||||||||||
| 15 | 87 | ▶ | sub get_name { | ||||||||||||||||||
|
Subroutine
get_name: called CC=1 SCAR=0.0
Pod
undocumented
| |||||||||||||||||||||
| 16 | 87 | return 'register request response'; | |||||||||||||||||||
| 17 | } | ||||||||||||||||||||
| 18 | |||||||||||||||||||||
| 19 | 0 | ▶ | sub execute { | ||||||||||||||||||
|
Subroutine
execute: not called CC=2 SCAR=17.9
Pod
undocumented
| |||||||||||||||||||||
| 20 | 0 | my ( $self, $ctx ) = @_; | |||||||||||||||||||
| 21 | 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")
| |||||||||||||||||||||
| 22 | |||||||||||||||||||||
| 23 | 0 | OpenInteract2::Setup->new( | |||||||||||||||||||
| 24 | 'require classes', | ||||||||||||||||||||
| 25 | classes => [ 'OpenInteract2::Request', 'OpenInteract2::Response' ], | ||||||||||||||||||||
| 26 | classes_type => 'Adapter parent classes', | ||||||||||||||||||||
| 27 | )->run(); | ||||||||||||||||||||
| 28 | |||||||||||||||||||||
| 29 | 0 | my $server_config = $ctx->server_config; | |||||||||||||||||||
| 30 | $self->_map_in_factory( | ||||||||||||||||||||
| 31 | 'OpenInteract2::Request', $server_config->{request} | ||||||||||||||||||||
| 32 | 0 | ); | |||||||||||||||||||
| 33 | $self->_map_in_factory( | ||||||||||||||||||||
| 34 | 'OpenInteract2::Response', $server_config->{response} | ||||||||||||||||||||
| 35 | 0 | ); | |||||||||||||||||||
| 36 | } | ||||||||||||||||||||
| 37 | |||||||||||||||||||||
| 38 | 0 | ▶ | sub _map_in_factory { | ||||||||||||||||||
|
Subroutine
_map_in_factory: not called CC=3 SCAR=24.8
| |||||||||||||||||||||
| 39 | 0 | my ( $self, $factory, $mappings ) = @_; | |||||||||||||||||||
| 40 | 0 | ▶ | return unless ( ref $mappings eq 'HASH' ); | ||||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||||
| 41 | 0 | ▶ | while ( my ( $impl_name, $impl_class ) = each %{ $mappings } ) { | ||||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||||
| 42 | 0 | $log->info( "Registering in factory $factory: ", | |||||||||||||||||||
| 43 | "$impl_name => $impl_class" ); | ||||||||||||||||||||
| 44 | 0 | $factory->register_factory_type( $impl_name, $impl_class ); | |||||||||||||||||||
| 45 | } | ||||||||||||||||||||
| 46 | } | ||||||||||||||||||||
| 47 | |||||||||||||||||||||
| 48 | 87 | OpenInteract2::Setup->register_factory_type( get_name() => __PACKAGE__ ); | |||||||||||||||||||
| 49 | |||||||||||||||||||||
| 50 | 87 | 1; | |||||||||||||||||||
| 51 | |||||||||||||||||||||
| 52 | __END__ | ||||||||||||||||||||