| 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
| |||||||||||||||||||||||||
| 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"
MC/DC0%0/1
$c->{'label_name'} || "Mail::$name"
$c->{'label_name'}
Truth table0%0/2
A
A= $c->{'label_name'}
| |||||||||||||||||||||||||
| 41 | 0 | $e->view_manager->add_register(0, $label, $dc); | |||||||||||||||||||||||
| 42 | 0 | ▶ | $base->default($label) if $c->{default}; | ||||||||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||||||||
| 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
| |||||||||||||||||||||||||
| 47 | 0 | ▶ | $base->default((keys %$labels)[0]) unless $base->default; | ||||||||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||||||||
| 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
| |||||||||||||||||||||||||
| 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.")
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
| |||||||||||||||||||||||||
| 54 | 0 | ▶ | $c->{mydomain} ||= $ENV{HOSTNAME} || 'localhost'; | ||||||||||||||||||||||
|
Condition0%0/5
$c->{"mydomain"} ||= $ENV{"HOSTNAME"} || "localhost"
$ENV{'HOSTNAME'} || 'localhost'
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'}
| |||||||||||||||||||||||||
| 55 | 0 | ▶ | $c->{to} ||= $e->lc_namespace. "\@$c->{mydomain}"; | ||||||||||||||||||||||
|
Condition0%0/3
$c->{"to"} ||= $e->lc_namespace . qq[\@$c->{"mydomain"}]
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"}]
| |||||||||||||||||||||||||
| 56 | 0 | ▶ | $c->{from} ||= $e->lc_namespace. "\@$c->{mydomain}"; | ||||||||||||||||||||||
|
Condition0%0/3
$c->{"from"} ||= $e->lc_namespace . qq[\@$c->{"mydomain"}]
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"}]
| |||||||||||||||||||||||||
| 57 | 0 | ▶ | $c->{subject} ||= "Hellow !!"; | ||||||||||||||||||||||
|
Condition0%0/2
$c->{"subject"} ||= "Hellow !!"
MC/DC0%0/1
$c->{"subject"} ||= "Hellow !!"
$c->{"subject"}
Truth table0%0/2
A
A= $c->{"subject"}
| |||||||||||||||||||||||||
| 58 | 0 | ▶ | $c->{x_mailer} ||= "Egg::View::Mail v$VERSION"; | ||||||||||||||||||||||
|
Condition0%0/2
$c->{"x_mailer"} ||= "Egg::View::Mail v$Egg::View::Mail::VERSION"
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"}
| |||||||||||||||||||||||||
| 59 | 0 | $c; | |||||||||||||||||||||||
| 60 | } | ||||||||||||||||||||||||
| 61 | |||||||||||||||||||||||||
| 62 | 2 | 1; | |||||||||||||||||||||||
| 63 | |||||||||||||||||||||||||
| 64 | __END__ | ||||||||||||||||||||||||