blib/lib/Egg/View/Mail.pm

filter: Statementstmt 36.3% 20 / 55 Branchbran 0.0% 0 / 10 Conditioncond 0.0% 0 / 19 MC/DCmcdc 0.0% 0 / 10 Subroutinesub 60.0% 6 / 10 Podpod n/a totaltotal 25.0% 26 / 104 CC 16 SCAR 38.0
CC
16
Cov
24%
_init_config
90.0
_setup
37.1
_setup
2.0
CRAP 44.7
« blib/lib/Egg/View/Mail/Plugin/Lot.pm ↑ Summary blib/lib/Egg/View/Mail/Plugin/EmbAgent.pm »
1 package Egg::View::Mail;
2 #
3 # Masatoshi Mizuno E<lt>lusheE<64>cpan.orgE<gt>
4 #
5 # $Id: Mail.pm 285 2008-02-28 04:20:55Z lushe $
6 #
7 2 ▶use strict;
Subroutine BEGIN: called CC=1 SCAR=0.0
8 2 ▶use warnings;
Subroutine BEGIN: called CC=1 SCAR=0.0
9  
10 2 our $VERSION = '0.01';
11  
12 0 ▶sub _setup {
Subroutine _setup: not called CC=1 SCAR=6.9
13 0 my($class, $e)= @_;
14 0 Egg::View::Mail::handler->_setup($e);
15 0 $class->next::method($e);
16 }
17  
18 package Egg::View::Mail::handler;
19 2 ▶use strict;
Subroutine BEGIN: called CC=1 SCAR=0.0
20  
21 0 ▶sub new {
Subroutine new: not called CC=1 SCAR=6.9
22 0 my($class, $e, $c, $default)= @_;
23 0 my $pkg= $e->project_name. '::View::Mail';
24 0 $e->view_manager->context($pkg->default);
25 }
26 0 ▶sub _setup {
Subroutine _setup: not called CC=8 SCAR=36.1
27 0 my($class, $e)= @_;
28 0 my $base= $e->project_name. '::View::Mail';
29 0 my $path= $e->path_to(qw{ lib_project View/Mail });
30 2 ▶ no strict 'refs'; ## no critic.
Subroutine BEGIN: called CC=1 SCAR=0.0
31 2 ▶ no warnings 'redefine';
Subroutine BEGIN: called CC=1 SCAR=0.0
32 0 push @{"${base}::ISA"}, 'Egg::Base';
33 0 $base->mk_classdata($_) for qw/ default labels /;
34 0 my $labels= $base->labels($e->ixhash);
35 0 ▶ for (sort (grep /.+\.pm$/, <$path/*>)) { ## no critic.
Subroutine BEGIN: called CC=1 SCAR=0.2
36 0 ▶ m{([^\\\/\:]+)\.pm$} || next;
Branch: 1 branch
BranchTrueFalseTotal
m[([^\\\/\:]+)\.pm$] or next 0 0 0
37 0 my $name = $1;
38 0 my $dc = "${base}::$name";
39 0 my $c= $class->_init_config($e, $dc);
40 0 ▶ my $label= lc( $c->{label_name} || "Mail::$name" );
Condition0%0/2
$c->{'label_name'} || "Mail::$name"
l!l
00
MC/DC0%0/1
$c->{'label_name'} || "Mail::$name"
$c->{'label_name'}
Truth table0%0/2
A
A= $c->{'label_name'}
Aresult
11
00
41 0 $e->view_manager->add_register(0, $label, $dc);
42 0 ▶ $base->default($label) if $c->{default};
Branch: 1 branch
BranchTrueFalseTotal
if $c->{"default"} 0 0 0
43 0 $labels->{$label}= $dc;
44 0 $dc->_setup($e);
45 }
46 0 ▶ %$labels || die __PACKAGE__. q{ - The Mail controller is not found.};
Branch: 1 branch
BranchTrueFalseTotal
%$labels or die "Egg::View::Mail::handler - The Mail controller is not found." 0 0 0
47 0 ▶ $base->default((keys %$labels)[0]) unless $base->default;
Branch: 1 branch
BranchTrueFalseTotal
unless $base->default 0 0 0
48 0 @_;
49 }
50 0 ▶sub _init_config {
Subroutine _init_config: not called CC=9 SCAR=45.0
51 0 my($class, $e, $dc)= @_;
52 0 ▶ $dc->require or die $@;
Branch: 1 branch
BranchTrueFalseTotal
$dc->require or die $@ 0 0 0
53 0 ▶ my $c= $dc->config || die __PACKAGE__. qq{ - '$dc' config is empty.};
Condition0%0/2
$dc->config || die('Egg::View::Mail::handler' . " - '${dc}' config is empty.")
l!l
00
MC/DC0%0/1
$dc->config || die('Egg::View::Mail::handler' . " - '${dc}' config is empty.")
$dc->config
Truth table0%0/2
A
A= $dc->config
Aresult
11
00
54 0 ▶ $c->{mydomain} ||= $ENV{HOSTNAME} || 'localhost';
Condition0%0/5
$c->{"mydomain"} ||= $ENV{"HOSTNAME"} || "localhost"
l!l&&r!l&&!r
000
$ENV{'HOSTNAME'} || 'localhost'
l!l
00
MC/DC0%0/2
$c->{"mydomain"} ||= $ENV{"HOSTNAME"} || "localhost"
$c->{"mydomain"} $ENV{'HOSTNAME'}
Truth table0%0/3
A ||= B
A= $c->{"mydomain"}B= $ENV{'HOSTNAME'}
ABresult
1X1
011
000
55 0 ▶ $c->{to} ||= $e->lc_namespace. "\@$c->{mydomain}";
Condition0%0/3
$c->{"to"} ||= $e->lc_namespace . qq[\@$c->{"mydomain"}]
l!l&&r!l&&!r
000
MC/DC0%0/2
$c->{"to"} ||= $e->lc_namespace . qq[\@$c->{"mydomain"}]
$c->{"to"} $e->lc_namespace . qq[\@$c->{"mydomain"}]
Truth table0%0/3
A ||= B
A= $c->{"to"}B= $e->lc_namespace . qq[\@$c->{"mydomain"}]
ABresult
1X1
011
000
56 0 ▶ $c->{from} ||= $e->lc_namespace. "\@$c->{mydomain}";
Condition0%0/3
$c->{"from"} ||= $e->lc_namespace . qq[\@$c->{"mydomain"}]
l!l&&r!l&&!r
000
MC/DC0%0/2
$c->{"from"} ||= $e->lc_namespace . qq[\@$c->{"mydomain"}]
$c->{"from"} $e->lc_namespace . qq[\@$c->{"mydomain"}]
Truth table0%0/3
A ||= B
A= $c->{"from"}B= $e->lc_namespace . qq[\@$c->{"mydomain"}]
ABresult
1X1
011
000
57 0 ▶ $c->{subject} ||= "Hellow !!";
Condition0%0/2
$c->{"subject"} ||= "Hellow !!"
l!l
00
MC/DC0%0/1
$c->{"subject"} ||= "Hellow !!"
$c->{"subject"}
Truth table0%0/2
A
A= $c->{"subject"}
Aresult
11
00
58 0 ▶ $c->{x_mailer} ||= "Egg::View::Mail v$VERSION";
Condition0%0/2
$c->{"x_mailer"} ||= "Egg::View::Mail v$Egg::View::Mail::VERSION"
l!l
00
MC/DC0%0/1
$c->{"x_mailer"} ||= "Egg::View::Mail v$Egg::View::Mail::VERSION"
$c->{"x_mailer"}
Truth table0%0/2
A
A= $c->{"x_mailer"}
Aresult
11
00
59 0 $c;
60 }
61  
62 2 1;
63  
64 __END__
« blib/lib/Egg/View/Mail/Plugin/Lot.pm ↑ Summary blib/lib/Egg/View/Mail/Plugin/EmbAgent.pm »