lib/Email/Blaster/Config.pm

filter: Statementstmt 26.0% 13 / 50 Branchbran 0.0% 0 / 6 Conditioncond n/a MC/DCmcdc n/a Subroutinesub 44.4% 4 / 9 Podpod 0.0% 0 / 2 totaltotal 25.3% 17 / 67 CC 4 SCAR 15.8
CC
4
Cov
23%
_load_class
12.0
throttled
6.0
new
2.0
CRAP 4.8
« lib/Email/Blaster/ConfigLoader.pm ↑ Summary lib/Email/Blaster/Throttled.pm »
1  
2 package Email::Blaster::Config;
3  
4 2 ▶use strict;
Subroutine BEGIN: called CC=1 SCAR=0.0
5 2 ▶use warnings 'all';
Subroutine BEGIN: called CC=1 SCAR=0.0
6 2 ▶use base 'Email::Blaster::ConfigNode';
Subroutine BEGIN: called CC=1 SCAR=0.0
7 2 ▶use Carp 'confess';
Subroutine BEGIN: called CC=1 SCAR=0.0
8  
9  
10 #==============================================================================
11 sub new
12 0 ▶{
Subroutine new: not called CC=1 SCAR=6.9
Pod undocumented
13 0 my ($class, $ref, $root) = @_;
14
15 0 my $s = $class->SUPER::new( $ref );
16
17 # Add our "libs" directories to @INC:
18 map {
19 0 $_ =~ s/\@ServerRoot@/$root/;
20 0 push @INC, $_;
21 0 } @{ $s->libs->lib };
22
23 0 return $s;
24 }# end new()
25  
26  
27 #==============================================================================
28 sub _init
29 0 ▶{
Subroutine _init: not called CC=1 SCAR=6.9
30 0 my ($s) = @_;
31  
32 # Make sure we can load all of our handlers:
33 0 local $SIG{__DIE__} = \&Carp::confess;
34 0 map { $s->_load_class( $_ ) } @{ $s->handlers->server_startup->handler };
35 0 map { $s->_load_class( $_ ) } @{ $s->handlers->server_shutdown->handler };
36 0 map { $s->_load_class( $_ ) } @{ $s->handlers->init_transmission->handler };
37 0 map { $s->_load_class( $_ ) } @{ $s->handlers->begin_transmission->handler };
38 0 map { $s->_load_class( $_ ) } @{ $s->handlers->end_transmission->handler };
39 0 map { $s->_load_class( $_ ) } @{ $s->handlers->message_bounced->handler };
40 }# end _init()
41  
42  
43 #==============================================================================
44 sub throttled
45 0 ▶{
Subroutine throttled: not called CC=2 SCAR=17.9
Pod undocumented
46 0 my $s = shift;
47
48 0 ▶ return wantarray ? @{ $s->{throttled}->throttle } : $s->{throttled}->throttle;
Branch: 1 branch
BranchTrueFalseTotal
wantarray ? : 0 0 0
49 }# end throttled()
50  
51  
52 #==============================================================================
53 sub _load_class
54 0 ▶{
Subroutine _load_class: not called CC=3 SCAR=24.8
55 0 my ($s, $class) = @_;
56
57 0 (my $file = "$class.pm") =~ s/::/\//g;
58 0 ▶ eval { require $file unless $INC{$file}; 1 } or confess "Cannot load $class: $@";
Branch: 2 branches
BranchTrueFalseTotal
eval { do { require $file unless $INC{$file}; 1 } } or confess("Cannot load ${class}: $@") 0 0 0
unless $INC{$file} 0 0 0
59 }# end _load_class()
60  
61  
62 #==============================================================================
63 sub DESTROY
64 0 ▶{
Subroutine DESTROY: not called CC=1 SCAR=6.9
65 0 my $s = shift;
66 0 undef(%$s);
67 }# end DESTROY()
68  
69 2 1;# return true:
70  
« lib/Email/Blaster/ConfigLoader.pm ↑ Summary lib/Email/Blaster/Throttled.pm »